??????????

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace GameClient
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender?? EventArgs e)
{
IPAddress serverIp = IPAddress.Parse("127.0.0.1");
string Port = "8001";
IPEndPoint serverhost = new IPEndPoint(serverIp?? Int32.Parse(Port));
Socket client = new Socket(AddressFamily.InterNetwork?? SocketType.Stream?? ProtocolType.Tcp);
try
{
client.Connect(serverhost);
}
catch
{
MessageBox.Show("???????");
return;
}
string id = textBox_id.Text;
//string pas = textBox_pas.Text;
// byte[] byteId = Encoding.ASCII.GetBytes(id.ToCharArray());
byte[] byteId = Encoding.GetEncoding("GB2312").GetBytes(id.ToCharArray());
//byte[] bytePas = Encoding.ASCII.GetBytes(pas.ToCharArray());
client.Send(byteId?? 0?? byteId.Length?? SocketFlags.None);
test.Text = Convert.ToString(byteId.Length);
//client.Send(bytePas?? 0?? bytePas.Length?? SocketFlags.None);
client.Close();
}
}
}
????Encoding.GetEncoding("GB2312").GetBytes(id.ToCharArray())??string id = Encoding.GetEncoding("GB2312").GetString(receive?? 0?? i)???????????????????????
???????Try??catch??????????顣????????????????????????????÷?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????