Using BSD style sockets ...

1. create socket using "socket()", specify AF_INET for the address family, IP_PROTO for protocol (I think), and SOCK_STREAM for TCP socket (SOCK_DGRAM for UDP)
2. optionally "bind()" the socket to a local interface.
3. connect the socket to the remote host.
4. use send() to send data and recv() to receive data.
5. calls normally block but you can enable non-blocking IO and use select() to determine which data has arrived or socket is ready to send again.

Plenty of code samples for the above online.

-rick