How to open and use a socket in C?

前端 未结 8 2061
生来不讨喜
生来不讨喜 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 22:02

    You're right, using sockets in C has a difficult syntax. Later languages like Java and Python make it a snap by comparison. The best tutorial I've found for doing socket programming in C is Beej's Guide to Network Programming. I recommend you start at the beginning to get a good overview, but if you just need to get some code working now, you can skip ahead to the section titled Client-Server Background.

    Good luck!

提交回复
热议问题