7,655
社区成员
发帖
与我相关
我的任务
分享
private static void send(SocketFlags f)
{
try
{
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
IPAddress ip = IPAddress.Parse("192.168.0.200");
IPEndPoint iep = new IPEndPoint(ip, 20000);
socket.Blocking = true;
//socket.SocketType = SocketType.Stream;
socket.Connect(iep);
int c = 0;
if (socket.Connected)
{
byte[] b;
string str;
str = f.ToString();
b = Encoding.Default.GetBytes(str);
c=socket.Send(b).ToString();
socket.Close();
}
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}