All pastes #784787 Raw Edit

Something

public text v1 · immutable
·published 2007-11-19 21:07 UTC
rendered paste body
#include <sys/types.h>
/*#include <sys/socket.h>*/
#include <netinet/in.h>
/*#include <netdb.h>*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/sctp.h>


int main(int argc,char *argv[]) {
        int i, out_offset = 0, inp_offset = 0, mode = 0;
        long rtt_delay = 0;
        long inp_count = 0, out_count = 0;
        long inp_bytes = 0, out_bytes = 0;

        if(argc!=2) {
                printf ("usage: client dest_ip\n");
                exit(1);
        }
        struct sockaddr_in addr;
        int    sd;
        setbuf(stdout,NULL);


        addr.sin_addr.s_addr = inet_addr(argv[1]);

        struct sockaddr_in sin;
        addr.sin_family=PF_INET;
        addr.sin_port=htons(6666);

        sd=socket(PF_INET,SOCK_SEQPACKET, IPPROTO_SCTP);
        if(sd<0) {
                perror(NULL);
                exit(1);
        }
        else printf("conecting...");
        if(connect(sd,(struct sockaddr *)&addr,sizeof(addr))<0) {
                perror(NULL);
                exit(1);
        }
        int n;
        char buff[4098];
        printf(recv(sd,buff,128,0));
        while((n=recv(sd,buff,strlen(buff),0))>0)printf(n);
        printf (buff);
        close(sd);