日期:2014-05-20 浏览次数:20796 次
protected static final int m_iMaxSize = 20480;
protected static DatagramSocket m_socket;
protected static int m_timeout = 3000;
protected static int m_Port = 5555;
protected static String m_Ip ="192.168.30.5";
private static byte[] datarecv = new byte[m_iMaxSize + 120];
/**
* @param args
*/
public static void main(String[] args) {
try {
m_Ip = args[0];
send s = new send();
m_socket = new DatagramSocket(m_Port, InetAddress.getByName(m_Ip));
int b = m_socket.getSendBufferSize();
int rb = m_socket.getReceiveBufferSize();
System.out.println("default SendBufferSize=" + b);
System.out.println("default ReceiveBufferSize=" + rb);
m_socket.setSendBufferSize(m_iMaxSize*1000);
m_socket.setReceiveBufferSize(m_iMaxSize*1000);
System.out.println("set SendBufferSize="+m_socket.getSendBufferSize());
System.out.println("set ReceiveBufferSize="+m_socket.getReceiveBufferSize());
s.start();
} catch (Exception e) {
System.out.println(e.toString());
}
}