How to establish UDP to pass argv[]

Hello, my friends. I want to establish UDP between client and server. On the client-side, I initialize my parameter with the command line, like ./hospitalA 2 10 8. What I wanna fulfill is to pass 10 and 8(argv[2], argv[3])(for example)from client to server. But I have some problems when referring to the sample code from http://www.beej.us/guide/bgnet/html/#datagram. Could you give me some hints on the main logic part? It would be a huge help if you can post your code.
> if ((numbytes = sendto(sockfd, argv[2], strlen(argv[2]), 0
So instead, it would be

1
2
3
char buff[100];
sprintf(buff,"%s:%s",argv[2],argv[3]);
if ((numbytes = sendto(sockfd, buff, strlen(buff), 0


Your partner would get the string "10:8", which they would then have to pick apart.
Registered users can post here. Sign in or register to post.