我正在使用通过TCP协议接收文件的应用程序,应用程序处理该文件,然后通过相同的协议发送它,我正在接收文件时没有问题我的问题是,当我尝试发送的文件,因为我需要将文件发送到另一个应用程序正在监听动态端口的代码,我使用发送这些文件是:通过TCP协议将文件发送到动态端口
internal void Send(byte[] buffer)
{
TcpClient _client = null;
try
{
_client = new TcpClient(RemoteIPaddress, Dynamic_port);
if (_client != null)
{
NetworkStream _clienttStream = _client.GetStream();
_clienttStream.Write(buffer, 0, buffer.Length);
_clienttStream.Flush();
_clienttStream.Close();
_clienttStream = null;
}
}
catch
{
if (_client != null)
{
_client.Close();
_client = null;
}
}
}
问题是,我怎样才能通过TCP协议将文件发送到使用动态端口的远程机器
我需要知道什么动态端口正在从客户端侦听 – 2012-04-23 17:37:01