views:

127

answers:

2

Hi all,

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

+3  A: 

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

http://beej.us/guide/bgnet/output/html/multipage/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++. Don't do it.

Tom Dignan
+1  A: 

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

TheJuice