Results 1 to 5 of 5

Thread: Doubt in Networking programming

  1. #1
    Junior Member
    Join Date
    Jan 2003

    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??

  2. #2
    Antionline Herpetologist
    Join Date
    Aug 2001
    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++.
    Buy the Snakes of India book, support research and education (sorry the website has been discontinued)
    My blog: http://biology000.blogspot.com

  3. #3
    Senior Member
    Join Date
    Nov 2002
    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
    Visit alastairgrant.ca

  4. #4
    Senior Member
    Join Date
    Jul 2001
    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.

    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

  5. #5
    Junior Member
    Join Date
    Jan 2003
    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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts