Hi everyone,

I'm using socket API to make a simple chat program using UDP socket (SO_BROADCAST)

To make it simple, at first, I created 1 socket named "socketa" in Application "AppA" to send message and created another socket "socketb" in Application "AppB" to receive message from "AppA". It worked perfectly, but only one-way.

So, I want it to work in two-way communication, i.e. both send and receive message. I wonder whether I should create more sockets, e.g. "socketa2" in Application "AppA" to receive message and "socketb2" in Application "AppB" to send message?

So, please tell me that can a socket both Send and Receive message? And how to design this two-way communication?

I'm new to c++ and also windows socket, so I really appreciate someone giving me a detailed example how to do this.

Thanks all.