Sender: This sample sends UDP datagrams to the specified
recipient. The -c option first calls connect() to associate the recipient’s
IP address with the socket handle so that the send() function can be used as
opposed to the sendto() call.

Compile:
cl -o Sender Sender.c ws2_32.lib
Command line options:
sender [-p:int] [-r:IP] [-c] [-n:x] [-b:x] [-d:c]
-p:int Remote port
-r:IP Recipient’s IP address or hostname
-c Connect to remote IP first
-n:x Number of times to send message
-b:x Size of buffer to send
-d:c Character to fill buffer with

Receiver: This sample receives UDP datagrams by binding to
the specified interface and port number and then blocking on a recvfrom()
call
Compile:
cl -o Receiver Receiver.c ws2_32.lib
Command line options:
sender [-p:int] [-i:IP][-n:x] [-b:x]
-p:int Local port
-i:IP Local IP address to listen on
-n:x Number of times to send message
-b:x Size of buffer to send

 

4 Shares