There are lots of ways to do this but how you do it depends on things like multi-threading skills and need for reliable delivery, etc.
Here's an option for TCP...
Open a new STREAM socket (the listen or bind socket) bind it to a port then call listen on it.
Call accept in a loop so that each time accept returns (which will be the result of a client connecting) create a new thread and pass the socket returned by accept (the client socket) to it. You can add the socket to an array to keep track of connected clients. The new thread then sits in a loop blocked on a recv. When a client sends data, the recv will unblock and you can do what you want with the data. You send data to the client by finding the appropriate client's socket in the array and just "send"ing to it from the UI thread.
When recv returns an error instead of data, it usually means that the client disconnected and you can do whatever cleanup you need including terminating the client thread.
Before threading became popular, the way to handle multiple clients was to use select. It monitors multiple sockets and tells you what sockets are ready to be read from or have errors. If you plan on handling lots of clients, this is actually a better way because it prevents having to have an thread for each connected client.
Another option is to use UDP (a DATAGRAM or connectionless socket). A single socket can receive message from any number of clients and can be easier to program. The downside is that UDP isn't a guaranteed delivery mechanism. You have to decide if losing a message is acceptable and if not, you'll have to write your own retransmission mechanism.