February 6th, 2003, 09:31 AM
Doubt in Networking programming
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??
February 6th, 2003, 10:28 AM
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++.
February 6th, 2003, 04:19 PM
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:
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.
\"When you say best friends, it means friends forever\" Brand New
\"Best friends means I pulled the trigger
Best friends means you get what you deserve\" Taking Back Sunday
February 6th, 2003, 05:42 PM
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.
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.
If you spend more on coffee than on IT security, you will be hacked. What\'s more, you deserve to be hacked.
-- former White House cybersecurity adviser Richard Clarke
February 7th, 2003, 05:07 AM
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..