简体   繁体   English

聊天服务器和客户端实现

[英]Chat server and client Implementation

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. 我想使用像gTalk这样的Java实现聊天服务器和客户端,我应该使用哪种类型的连接( XAMPPSocket Connection ),请指导我,我想在我的最终sem项目中实现它。 Instant Messaging例如gTalk和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. XAMPP主要是一个软件包,主要是Apache Web服务器,MySQL,Perl和PHP。 Since you want to code in java, the chat server would be based on Socket Programming. 由于您要使用Java进行编码,因此聊天服务器将基于套接字编程。

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. 按照您发布的代码片段,它是一个简单的Java服务器,它可以侦听请求并在屏幕上打印发送给它的内容。

On doing some google search found a simple step by step explanation of creating chat application in java. 在进行一些Google搜索时,发现了用Java创建聊天应用程序的简单逐步说明。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM