OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Using a Datagram Server
  1. Create the socket (socket()):
    TDatagramSocket socket(TINetSocketAddress());
    socket.CreateSocket();
  2. Bind the socket to a well-known name (bind()):
    socket.BindSocket();
    socket.SetPeerAddress(TINetSocketAddress(htons(2050), INADDR_BROADCAST));
  3. To Write (sendto()):
    socket.Write("Hello");
  4. To Read (recvfrom()):
    char buffer[80];
    socket.Read(buffer, sizeof(buffer));
  5. Close the connection (closesocket()):
    socket.CloseSocket();