|
-
February 6th, 2003, 10:31 AM
#1
Junior Member
Doubt in Networking programming
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??
-
February 6th, 2003, 11:28 AM
#2
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
-
February 6th, 2003, 05:19 PM
#3
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.
\"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
Visit alastairgrant.ca
-
February 6th, 2003, 06:42 PM
#4
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
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, 06:07 AM
#5
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|