对于Windows,有谁知道一个非常好的客户端/服务器tcp / udp终端实用程序?

时间:2010-05-20 13:51:45

标签: debugging tcp udp

我想要一个实用程序,它允许我发送/接收tcp和udp消息作为客户端或服务器,汇编数据包,设置响应等...最好在Windows上。如果你看过这样的话,请告诉我。谢谢!

4 个答案:

答案 0 :(得分:4)

我使用"Hercules SETUP Utility"。乍一看它看起来太简单了,但它确实是非常有用的功能。

答案 1 :(得分:1)

为什么不用其中一种.NET语言在System.Net中尝试TcpClient和TcpListener?使用这些类为您自己实现客户端/服务器系统非常简单。

答案 2 :(得分:0)

您可以在Windows上使用Docklight Scripting的免费评估版(无时间限制)执行以下操作:

  • 向/从TCP服务器发送/接收ASCII或二进制消息。
  • 是一个TCP服务器并接受一个传入连接,然后再次能够接收和发送TCP消息。包括发送自动答案/对传入数据的反应。
  • 充当UDP对等体并发送/接收UDP消息。

我没有尝试过的另一种免费软件解决方案,但看起来非常好Packet Sender

答案 3 :(得分:-1)

//Server Binding

IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, 2015);
serverSocket.Bind(ipEndPoint);

//Begin Recceive from any client
IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 0);
EndPoint epSender = (EndPoint)ipeSender;
serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length, SocketFlags.None, ref epSender, new AsyncCallback(OnNetworkBytesReceived), epSender);


private void OnNetworkBytesReceived(IAsyncResult ar)
{
   IPEndPoint ipeSender = new IPEndPoint(IPAddress.Any, 0);
   EndPoint epSender = (EndPoint)ipeSender;
   int BytesRead = serverSocket.EndReceiveFrom(ar, ref epSender);
   //parse your data
   ParseNetworkBytes(BytesRead, epSender);
   serverSocket.BeginReceiveFrom(byteData, 0, byteData.Length, SocketFlags.None, ref    epSender, new AsyncCallback(OnNetworkBytesReceived), epSender);

}//OnNetworkBytesReceived()

//for sending to client
Byte[] byteDataTemp = msg.messagePacketByLength(i, Constants.MAXSENDBUFFERSIZE);
serverSocket.BeginSendTo(byteDataTemp, 0, byteDataTemp.Length, SocketFlags.None, epRcvr, new AsyncCallback(OnSend), null);


private void OnSend(IAsyncResult ar)
{ 
    try
    { 
        lock (serverSocket)
        { 
            serverSocket.EndSendTo(ar);
        } 
    } 
    catch (ObjectDisposedException objexp)
    { 

    } 
    catch (Exception exp)
    { 

    } 
}//OnSend()