4

I.e. am I able to read from and write to the same socket using two different threads, given that I'm doing all communication in the form of datagrams?

Delimitry
  • 2,987
  • 4
  • 30
  • 39
Sam
  • 95
  • 1
  • 9
  • How does the code for this work? Is it fine to create one datagram socket, and use socket.receive as well as socket.send from two different threads? – Sam Mar 11 '14 at 15:18

2 Answers2

4

UDP, in the right circumstances, can be considered fully duplex, but by itself, it is not, whereas TCP, on the other hand, is always fully duplex.

UDP is a fire-and-forget, best-effort protocol, but the upper layers can use it in a fully duplex fashion.

TCP requires handshaking and other two-way communication.

Ron Maupin
  • 6,180
  • 4
  • 29
  • 36
0

UDP IS in fact fully duplex.

You can have a server listening from as well as writing to the same socket

Sam
  • 95
  • 1
  • 9