The Artima Developer Community
Sponsored Link

Java Answers Forum
Chat Application

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
BJ

Posts: 1
Nickname: jim8
Registered: Nov, 2002

Chat Application Posted: Nov 29, 2002 10:25 AM
Reply to this message Reply
Advertisement
I trying to write a chat application that keep record who login and logout. i already created server, class, interface, and event management. i have hard time creating client for this server.

import java.io.*;
import java.net.*;

public class CommServer extends CommWatcher implements Runnable
{
Thread m_thread;
public void run()
{
try
{
// create a 'passive' connection listening on port 1234
ServerSocket server = new ServerSocket( 1234 );

while( true )
{
// wait for a connection
Socket s = server.accept();

System.out.println( "Client connection" );

ClientComm comm = new ClientComm( s, this );
addCommListener( comm );
}
}
catch( Exception e )
{
System.out.println( "Server just died..." );
}
}

public CommServer()
{
m_thread = new Thread( this );
m_thread.start();
}

public static void main( String[] args )
{
new CommServer();
}
}

Topic: creation of .RTF file in java Previous Topic   Next Topic Topic: dear Moderator. Please block homework requests

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use