求求各位大侠看看。
private Socket DirectConnect(string v_sHost, int v_iPort){
try
{
//IPHostEntry iphe = Dns.GetHostByName(v_sHost);
//IPEndPoint iep = new IPEndPoint(iphe.AddressList[0], v_iPort);
IPEndPoint iep = new IPEndPoint(IPAddress.Parse(v_sHost), v_iPort);
m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
m_Socket.Connect(iep);
}
catch (Exception e)
{
string msg = "连接主机 [ " + v_sHost + " , " + v_iPort + " ]失败.\n\n";
msg += CommUtil.GetExceptionMsg(e);
//CommUtil.ShowInfoMsg(msg);
return null;
}
return m_Socket;
}
运行在这里的时候有异常提示:EnableBroadcast = “m_Socket.EnableBroadcast”引发了“System.Net.Sockets.SocketException”类型的异常
base {System.ComponentModel.Win32Exception} = {"在 getsockopt 或 setsockopt 调用中指定的一个未知的、无效的或不受支持的选项或层次。"}
应该怎么改?
m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); --------------------编程问答-------------------- 你搞定了吗?
补充:.NET技术 , C#