How to open and use a socket in C?

前端 未结 8 2037
生来不讨喜
生来不讨喜 2020-12-13 21:19

I would like to know the simplest and most effective way to open and write data to a socket in the C programming language for network programming.

8条回答
  •  时光说笑
    2020-12-13 21:56

    Reading and writing from basic sockets is not any harder than reading and writing normal files (just use recv instead of read and send instead if write). Things get a little trickey when you need to open a socket. The reason for that is because there are many different ways to communicate using sockets (TCP, UDP, etc).

提交回复
热议问题