=?Utf-8?B?cm9kY2hhcg==?=
10/30/2003 6:43:00 AM
hi, everybody,
I can use the following code to send the text "Apple" to
the "192.168.101.182" pc. But on the "192.168.101.182" pc
how can I write code to receive the "Apple" text. Thanks.
Encoding ASCII = Encoding.ASCII;
string Get = "Applle";
Byte[] ByteGet = ASCII.GetBytes(Get);
Byte[] RecvBytes = new Byte[256];
String strRetPage = null;
IPAddress hostadd = new IPAddress.Parse("192.168.101.182");
IPEndPoint EPhost = new IPEndPoint(hostadd, 80);
//Creates the Socket for sending data over TCP.
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,ProtocolType.Tcp );
// Connects to the host using IPEndPoint.
s.Connect(EPhost);
if (!s.Connected)
{
strRetPage = "Unable to connect to host";
}
// Sends the GET text to the host.
s.Send(ByteGet, ByteGet.Length, SocketFlags.None);