简体   繁体   中英

Simple socket server for Linux

I want TCP/IP based socket server application or code for Linux, which performs a very simple operation: reads xml string from one of the connected socket clients and forwards it to all socket clients which are connected to it.

I have such client server application developed in cocoa, but according to my requirements now I need server application developed for Linux. So I think code or application in C, C++, or Java will be required.

Can anyone suggest me some socket server application, code or link ?

Thanks,

Miraaj

This is the best free tutorial on the net for linux/unix socket programming in C.

https://beej.us/guide/bgnet/html/multi/index.html

It has example code.

If you want to get serious, buy the Unix Network Programming books by W. Richard Stevens.

I've also done sockets in Java, and they're really easy. Not to mention that concurrency in Java is also really easy, and often necessary when writing network programs. Just googling java socket should get your the documentation from sun's website for that.

Your C++ solution will just use the unix sockets api, so it would be no different than the C solution. For this reason, I see it as unnecessary to use C++.

Edit: So, I recently tried boost.asio. It's a decent solution if you like the async paradigm, try it with C++!

Have you had a look at Boost.Asio ? There are a few tutorials on there which may help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM