Using System;
Using System. Collections. Generic;
Using System. text;
Using System. net;
Using System. net. Sockets;
Using System. Threading;
Namespace Scoketproxy
{
Class Zserver
{
Manualresetevent clientconnected = New Manualresetevent ( False );
Tcplistener TL;
Public Zserver ( Int Port)
{
TL= NewTcplistener (port );
}
Byte [] Buf = New Byte [Client. Available];
NS. Read (BUF, 0 , Buf. Length );
String S = Getstring (BUF );
If (S = " \ R \ n " )
{
Break;
}
SB. append (s );
}
Return SB. tostring ();
}
Byte [] Readblock (tcpclient client)
{
System. Collections. Generic. List < Byte > R = New List < Byte > ();
While (Client. getstream (). dataavailable)
{
Byte [] Buf = New Byte [ 1 ];
Client. getstream (). Read (BUF, 0 , Buf. Length );
R. Add (BUF [ 0 ]);
}
Return R. toarray ();
}
Int Sendblock (tcpclient C, Byte [] BUF)
{
C. getstream (). Write (BUF,0, Buf. Length );
ReturnBuf. length;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.