各位大哥,请问receive和recv这两个函数还有OnReceive消息响应函数具体怎么用啊,有什么区别?我最近看别人程序有点晕,新手请教 呵呵:)

解决方案 »

  1.   

    receive   : Receives a datagram packet from this socket. When this method returns, the DatagramPacket's buffer is filled with the data received. The datagram packet also contains the sender's IP address, and the port number on the sender's machine. 
    This method blocks until a datagram is received. The length field of the datagram packet object contains the length of the received message. If the message is longer than the buffer length, the message is truncated.rev    : receives data from a connected socket.OnReceive : use directly when you want
      

  2.   

    winsock接收数据,一般流式套接字使用recv,而数据包套接字使用receive
      

  3.   

    套接字使用recv接受控制信息,数据包套接字使用receive接受数据,服务器接受OnReceive响应时调用