hi
This regarding Unix Network Programming v/s JAVA network programming...
Can any one out there tell me,
Which one is more simpler (programmer-friendly??)
and which one is more powerful??
Printable View
hi
This regarding Unix Network Programming v/s JAVA network programming...
Can any one out there tell me,
Which one is more simpler (programmer-friendly??)
and which one is more powerful??
First off, what do you mean by UNIX network programming? You can write network code for UNIX in Java as well. I'll assume that you mean network programming with C/C++ for UNIX. In that case, Java is definitely easier to learn and has more functionality straight off. But if you want to write a custom protocol or something, then you're better off using C/C++.
Cheers,
cgkanchi
As cgkanchi said, Java networking is very simple
The server needs little code:
ServerSocket ss = new ServerSocket(portNumber);
Socket c = ss.accept();
To connect the client to the server you need one line
Socket s = new Socket(hostName, portNumber);
and then you can create input and output streams on the Socket s and Socket c to make them talk back and forth.
You can get some more info on these classes on the Java API site:
http://java.sun.com/j2se/1.4.1/docs/api/
My Java textbook said C++ sockets were more difficult than Java sockets. The code looked a bit more confusing. Whether that is true or not I have yet to find out.
I've never written Java code for sockets but it sounds eassier then doing it in C (which I have done). If I recall there are 3 functions that you use in C.
Bind (params)
Listen (params)
Accept (params)
If you have a good understanding of C and a good reference then C sockets are not hard. I used.
Attached is an old assignment that did client server communiucation via sockets and some simple queingg, hashing and basic thread operations . It was compiled in a Compaq Alpha 4100 (64 bit system).
Hope it helps.
Cheers,
-D
I actually meant Unix Network programming using C..
I'm pretty good in C programming but I haven't tried socket programming in C yet. So I guess, I'll stick to JAVA...
Thanks a lot..
NulTraX