문제

I want to Implement a Chat Server and Client using java like gTalk, what Type of connection should i work on(XAMPP or Socket Connection), please guide me, i want to implement this for my final sem project.It will be a kind of Instant Messaging like gTalk and skype.

Please give me some idea/outlines or links where i can read some stuff, so that i can study some and start implementing those.

try {
     Socket skt = new Socket("localhost", 1234);
     BufferedReader in = new BufferedReader(new
        InputStreamReader(skt.getInputStream()));
     System.out.print("Received string: '");

     while (!in.ready()) {}
     System.out.println(in.readLine()); // Read one line and output it

     System.out.print("'\n");
     in.close();
  }
  catch(Exception e) {
     System.out.print("Whoops! It didn't work!\n");
  }

Thanks

도움이 되었습니까?

해결책

XAMPP is mostly a package of software mainly Apache webserver, MySQL, Perl and PHP. Since you want to code in java, the chat server would be based on Socket Programming.

As per the code snippet you have posted is a simple java server, which can listen to request and print on screen what's been send to it.

On doing some google search found a simple step by step explanation of creating chat application in java.

http://pirate.shu.edu/~wachsmut/Teaching/CSAS2214/Virtual/Lectures/chat-client-server.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top