OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Using a Stream Client
  1. Create a stream socket (socket()):
    TStreamSocket socket(TINetSocketAddress());
    socket.CreateSocket();
  2. Connect to the server (connect()):
    socket.Connect(TINetSocketAddress(htons(2000),
    TINetSocketAddress::ConvertAddress("soyeun@harvard.edu"));
  3. To Write (send()):
    socket.Write("Hello");
  4. To Read (recv()):
    char buffer[80];
    socket.Read(buffer, sizeof(buffer));
  5. Close the connection (closesocket()):
    socket.CloseSocket();