Datagram sockets, sequence of methods to call
-
How to use datagram sockets? ie what are the methods to call, to create a server or listening socket nd client socket. 1. create socket using create method,I creted 2 sockets. But I dint know,whether two should be on same port or not. Next what I have to do? CAll the connect method? Anyone pl help me to use SOCK_DGRAM option ie the sequence od opertaions for datagrams. Thanku :confused: :confused: Be creative Once your mind is streched by a new idea, it will never regain its original dimension
-
How to use datagram sockets? ie what are the methods to call, to create a server or listening socket nd client socket. 1. create socket using create method,I creted 2 sockets. But I dint know,whether two should be on same port or not. Next what I have to do? CAll the connect method? Anyone pl help me to use SOCK_DGRAM option ie the sequence od opertaions for datagrams. Thanku :confused: :confused: Be creative Once your mind is streched by a new idea, it will never regain its original dimension
Datagram sockets don't have a method to connect... use sendto and recvfrom for send/receive data with this socket Antonio
-
How to use datagram sockets? ie what are the methods to call, to create a server or listening socket nd client socket. 1. create socket using create method,I creted 2 sockets. But I dint know,whether two should be on same port or not. Next what I have to do? CAll the connect method? Anyone pl help me to use SOCK_DGRAM option ie the sequence od opertaions for datagrams. Thanku :confused: :confused: Be creative Once your mind is streched by a new idea, it will never regain its original dimension
As mrcod said, there's no connect() or accept() for datagram sockets, since they are connectionless socket. Usually what I do is: the one send data: socket(); get receiver's address (fill in struct sockaddr_in with the receiver's ip address and port number); sendto(); the one receive data: socket(); bind(); set it to a non-blocking socket if you'd like to recvfrom();