The newserver.cxx program creates an UDP object and assigns port number 6000 as the transmitting port by calling the init() method. It receives messages from the client and sends a reply to the client. To make sure that the current client has not already been encountered a CheckClient function can be written using the clone() and copyReceiveAddressToSendAddress() methods.
The newclient.cxx program opens a dynamic port (ie. port number is not specified for a client object in the init() method). To send data to the server the port number is specified in setSendAddress() . After this writev() and readv() can be used to communicate with the server.
Performance monnitoring methods are also available with this class.
The ioserverudp.cxx program in the demo sets up a UDP server and the ioclientudp.cxx program runs a client which connects to the server. The server creates two objects of QUANTAnet_iovec_c sr_send_iovec and sr_recv_iovec which has 2 and 4 iovec structures to send and read data respectively from the clients. Similarly, the client creates two objects of QUANTAnet_iovec_c cl_send_iovec and cl_recv_iovec which has 4 and 2 iovec structures to send and read data respectively to the server.Both the server and the client use the add method to data to the iovec structures.
2.To
run a client
ioclientudp<server-address>
Data received from Client IP:206.220.241.53 Port:33136
mesg1: 1
mesg1: 2
mesg1: 3
mesg1: 4
mesg1: 5
mesg2: 1.100000
mesg2: 2.200000
mesg2: 3.300000
mesg2: 4.400000
mesg2: 5.500000
mesg3: 1.100000
mesg3: 2.200000
mesg3: 3.300000
mesg3: 4.400000
mesg3: 5.500000
mesg4: cavern
Sent data to Client. IP:206.220.241.53 Port:33136
Client IP 10.0.0.81, Port: 33136
Sent data to Server
Message from server >>>>>> Server Alive >>>>>
Client IP 10.0.0.81, Port: 33136
for more information: Post your questions online on the Quanta forum page.