All pastes #781058 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-11-18 19:21 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>
#define MSG_LEN 64
int len = MSG_LEN;
unsigned char ur_msg[8192];
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[128];
        while((n=recv(sd,buff,128,0))>0) write (STDOUT_FILENO, buff,n);
        close(sd);

}