public void sentMsg(DatagramPacket packet)
{
try
{
// Create a datagram socket
DatagramSocket socket = new DatagramSocket();
//send the packet through socket
socket.send(packet);
//close socket
socket.close();
} catch(Exception e)
{
System.err.println(e);
}
}
我写的这个比较简单,udp协议的点对点
{
try
{
// Create a datagram socket
DatagramSocket socket = new DatagramSocket();
//send the packet through socket
socket.send(packet);
//close socket
socket.close();
} catch(Exception e)
{
System.err.println(e);
}
}
我写的这个比较简单,udp协议的点对点
传送数据包的例子!!!
使用API编写的WinSock的TCP/IP程序Windy
谢谢了