Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java Chat program

  • 26-11-2005 5:40pm
    #1
    Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭


    Im in the process of making a very simple chat program for a college project.
    Two pc's connect to a server program and a chat can commence.

    Its a simple program but works.

    However i want to improve the program for my own uses.

    I want each chat client to be able to detect when a server is available.

    How would this be implemented.

    The program is for use on a LAN network so would it be possible to send a broadcast message and the ones that are running the client would detect the message.


Comments

  • Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭damnyanks


    Do something to do a hand shake with the server be it a "Are you alive" message (Ping etc.)

    If it is... then it's alive
    if its not... then its not live


  • Closed Accounts Posts: 920 ✭✭✭elvis2002


    you could send a message to the multicast IP address instead of the server IP. If the program detects a message as 'Are u alive? say', it sends back "Im Alive, my IP is...."?


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    elvis2002 wrote:
    you could send a message to the multicast IP address instead of the server IP. If the program detects a message as 'Are u alive? say', it sends back "Im Alive, my IP is...."?
    You could, but there are relatively few multicast enabled routers out there...


  • Registered Users, Registered Users 2 Posts: 4,940 ✭✭✭dingding


    Both would have to be on the same segment of the network. Routers intentionally block broadcasts, they only allow certain ones through i.e. dhcp requests and even this functionally has to be enabled on the router. ;)


  • Registered Users, Registered Users 2 Posts: 15,503 ✭✭✭✭jellie


    if you want to change it for personal use wont you have to consider security, firewalls, etc?

    dunno how important these would be to you


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    damnyanks wrote:
    Do something to do a hand shake with the server be it a "Are you alive" message (Ping etc.)

    If it is... then it's alive
    if its not... then its not live


    That would be easy enough to do once the IP address was always the same.

    I was thinking more along the line of anyone could start up a server and the client would be able to detect the server.

    You know the way in multiplayer games eg COD when you start up a LAN game and all the other people that want to play can just refresh a list and all the available LAN server show up on a list.

    How is that implemented?


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    That would usually be because for internet games the game is connecting to a central registry where all active games are listed, and the status of the game would be sent periodically to the server. For LAN games, LANs would usually have a very limitied IP range, so it would be more feasible to send out a "whose serving" packet to all addresses on the LAN and see who replies.


  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    ...For LAN games, LANs would usually have a very limitied IP range, so it would be more feasible to send out a "whose serving" packet to all addresses on the LAN and see who replies.

    I wish to implement the chat on a LAN so could i do the same and how?


  • Registered Users, Registered Users 2 Posts: 1,606 ✭✭✭djmarkus


    i developed this exact thing in VB, of course it'd be alot more difficult in java. i used UDP broadcast to broadcast a "Im Here" packet.


  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    Why do you say it would be more difficult in java


  • Advertisement
  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    I wish to implement the chat on a LAN so could i do the same and how?
    Questions to ask yourself:

    What IP address is my program on?
    What can this tell me about the range of IPs my LAN is on?
    How can I check another IP address for a server?
    Why do you say it would be more difficult in java
    Probably because he is talking out his arse.


  • Registered Users, Registered Users 2 Posts: 2,243 ✭✭✭zoro


    Probably because he is talking out his arse.
    Completely ...

    To the OP: This project is certainly possible, but your first step should be to get a simple echoserver up and running.
    This will allow you to connect to your server from 2 clients, and they should be able to talk to each other.

    Once it's working, make the server multi-threaded and then start to work on your protocol.
    ie: MSG Zoro Hey there everyone
    would mean that the user "Zoro" is saying "Hey there everyone" to the entire chat-channel.

    It's not a very complicated project, so don't worry yourself too much about it.
    Reread my reply, the start to your project can be found on google if you look for it (it's where I got the base for my chat application after all) - all you need to do it make it work as you want it to.

    Zoro


  • Registered Users, Registered Users 2 Posts: 1,606 ✭✭✭djmarkus


    Questions to ask yourself:

    What IP address is my program on?
    What can this tell me about the range of IPs my LAN is on?
    How can I check another IP address for a server?


    Probably because he is talking out his arse.
    Eh, no, VB is piss easy, easily the easiest language i know(probably not the most efficient), thats out of c, c++, VB and java, unless you know both vb and java dont question me.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    djmarkus wrote:
    unless you know both vb and java dont question me.
    I do, so I will. Thanks anyway.


Advertisement