C++ networking simple send and receive
I'm trying to link 10 computers together, the program I would like to write would have one 'control开发者_Go百科' computer. From what I've looked up this computer would take all the packets sent over the network and do a echo with them... right? The other computers would need to be able to send information (then echoed to the others) to the 'control' ... is there a easy! or simple way to do this? From what I've seen I want a non-blocking socket?
I have looked into sockets and such but for an amateur programmer like me, this seems like a daunting task :)
I'm kind-of looking for an easy class implication that has a send()
and an event driven recv()
.
I'm not going to be sending that much information over the network.
http://beej.us/guide/bgnet/
In my opinion the unchallenged best guide to socket programming.
Any communications over a network requires you to have some understanding of networking in general. Even an echo server will have to decide to block in a single thread or provide multiple threads up to a point. What protocol? What is the target space (traditional Internet, isolated LAN, etc)?
W. Richards Stevens wrote good books on the subject (UNIX-based). Beej is another good online resource.
If you are really looking for easy why not just use a scripting language such as Ruby or Python to do this?
精彩评论