⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myserver.java

📁 用jsp做的能够实现简单的短信息发送回复的短消息系统
💻 JAVA
字号:
import java.io.*;
import java.net.*;

public class MyServer 
{
	public  static  void  main(String[]args) throws IOException
	{
	String str = new String();
	char  str1[] = new char[1024];
	ServerSocket server=new ServerSocket(8005);
	System.out.println("你好我是张明socket");
	Socket client = server.accept();
	System.out.println("你好我是张明");
	 try
	     	       {
	     	       	int streamlong = client.getReceiveBufferSize();
			System.out.println("you stream long is "+streamlong);
			BufferedReader in=new BufferedReader (new InputStreamReader (client.getInputStream()));
			System.out.println("you come reader");
			PrintWriter out=new PrintWriter(client.getOutputStream());
			

			System.out.println("Hello ");
			
			in.mark(streamlong);
				
			in.reset();
			
			if ( in.ready())
			{
	
		     
 			str = in.readLine();
 			//out.writeUTF("hasrecevi ");
 			System.out.println(str);
 			}
 			else
 			{
 			 System.out.println("stream is not ready  ");
 			}
 		       }
			
			catch(IOException ioe )
			{
				System.out.println(ioe.getMessage());
			}
			//System.out.println("Hello ni hao ");
			finally
			{
		         System.out.println(str);
			}
		
 			//out.println("hasreceive....");
 			//out.flush();
 			//if(str.equals("end"))
 			
		
	client.close();
 	} 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -