Java Networking

Discussion in 'OT Technology' started by CompiledMonkey, Jun 22, 2003.

  1. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Can anyone recommend a good book on the subject? For my final project, I want to make a chat program. Not like IM where you can have private chats, but a central server everyone logs into. I started playing around with Datagrams yesterday, and it worked out better than I expected.

    Question about connections, I think I'm going to have a problem presenting my project. I was planning on running the server on a computer at my house, so the client computer at school would need to allow me to make a connection on some random port, which I'm sure it won't allow. Any tips here?
     
    Last edited: Jun 22, 2003
  2. crotchfruit

    crotchfruit Guest

    for a chatroom, you really don't need a book. just find a simple chatroom sample online and learn from that. if you really want to buy a book, the Java In a Nutshell book has a good sample in the networking section.

    also for chatrooms, you should be using TCP sockets, not UDP [datagram].

    the first half of this pdf is useful:
    http://pvdl.best.vwh.net/jj5.pdf
     
  3. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    I'd like to have something tangible to read over. I found this tutorial, which I've found quite good.

    http://www.cn-java.com/download/data/book/socket_chat.pdf

    I'm going to keep going over this code and learn it. Figure out why they are doing what they are doing, and so on. I do hope to get a quality book though.

    Yeah, half way through the datagram reading I figured out that I wouldn't have persistent connections. Which for a chatroom is required. So now I'm using Sockets.
     
  4. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    yea i love learning from books
     
  5. crotchfruit

    crotchfruit Guest

    are you making cilent/server applets, or console applications?

    to solve the 'serve from home' connection problem, you could just run the server on one of the school computers and connect to it from others on the lan.
     
  6. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    The server will be console based and the client will be launched from an Applet.

    Yeah, I guess I could do that.
     
  7. crotchfruit

    crotchfruit Guest

  8. Auream

    Auream New Member

    Joined:
    Sep 24, 2002
    Messages:
    276
    Likes Received:
    0
    Location:
    Syracuse, NY
    My final project in CS last quarter involved writing a chat client. The server was already provided for us (not that it would be too difficult to implement). It had to be multithreaded, which was a bit of a pain. There may be some info you can use on the project page, though, so check it out. It has a ton of code that you might want to look at (as like I said, all the server stuff was provided).

    CS3 Chat Project Page
     

Share This Page