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 network programming

  • 28-04-2005 12:07pm
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    I want to connect two computers over a network using java and have a continous communication. Just like an instant text conversation. At the console window. I was wondering how to do this. Is the best way to use ServerSocket Channels. For instance something like:

    ServerSocketChannel serverChannel = ServerSocketChannel.open();

    ServerSocket ss = serverChannel.socket();
    ss.bind(new InetSocketAddress(1024));

    I want the console window to remain open while text is sent back and forth.


Comments

  • Closed Accounts Posts: 25 dan_pretty_boy


    Hi,

    Have a look at Jabber...


    danny


  • Registered Users, Registered Users 2 Posts: 648 ✭✭✭Neo#


    I actually want to do this myself manually as its part of a project. Thanks anyway.


  • Registered Users, Registered Users 2 Posts: 304 ✭✭PhantomBeaker


    I'm just guessing here but maybe try this?

    put it in a loop like
    while(serverChannel.isOpen()){
    // body of text is here?
    }
    

    So once the connection closes the console window can close. That's just my first impression. I could be wrong here.


  • Closed Accounts Posts: 3 I


    Depends what kind of connection you want. If you need one machine to be able to execute code on the other then take a look at RMI


  • Registered Users, Registered Users 2 Posts: 648 ✭✭✭Neo#


    Will do. Thanks.


  • Advertisement
Advertisement