- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
import java.io.*;
import java.net.*;
public class Server
static final int size = 10240;
static String DiskInfoXML = usrDir + "disk_info.xml";
public static void main(String argv)
DatagramSocket sd = null;
String diskRequest;
try
sd = new DatagramSocket(7777); //建立socket连接
while (true) //一直监听
byte buffer = new byte[size];
sd.receive(packet);
int port = packet.getPort();
InetAddress address = packet.getAddress();
System.out.println( "diskRequest = "n" + diskRequest);
fout.write(buffer,0,len); //写进文件
System.out.println(len+ " bytes received");
}
{
}
{
}
}
/************************* Client *******************************
import java.io.*;
public class Client
public static void main(String argv)
try
int bufferSize = 1024;
int remotePort=7777;
String diskInfoXML = usrDir + "disk_info.xml";
FileInputStream fr = new FileInputStream(f);
Long l=Long.valueOf(f.length());
byte buffer = new byte[len];
for(int i=0;i System.out.print((char)buffer);
Socket sd = new Socket(remoteHost, remotePort,false);
OutputStream out = sd.getOutputStream();
out.flush();
catch (IOException e)
System.out.println(e.toString());
System.out.println( "Send OK ...");
责编:罗莉
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>