Server status code moved from socket class. It should have never been here.
This commit is contained in:
parent
29561d2342
commit
c0112fa637
|
@ -17,7 +17,6 @@ Uses
|
||||||
cNetDB,
|
cNetDB,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Sockets,
|
Sockets,
|
||||||
Classes,
|
|
||||||
m_DateTime,
|
m_DateTime,
|
||||||
m_Strings;
|
m_Strings;
|
||||||
|
|
||||||
|
@ -28,8 +27,6 @@ Type
|
||||||
TSocketBuffer = Array[0..TSocketBufferSize] of Char;
|
TSocketBuffer = Array[0..TSocketBufferSize] of Char;
|
||||||
|
|
||||||
TSocketClass = Class
|
TSocketClass = Class
|
||||||
SocketStatus : TStringList;
|
|
||||||
StatusUpdated : Boolean;
|
|
||||||
FSocketHandle : LongInt;
|
FSocketHandle : LongInt;
|
||||||
FPort : LongInt;
|
FPort : LongInt;
|
||||||
FPeerName : String;
|
FPeerName : String;
|
||||||
|
@ -77,7 +74,6 @@ Type
|
||||||
Function PeekChar (Num: Byte) : Char;
|
Function PeekChar (Num: Byte) : Char;
|
||||||
Function ReadChar : Char;
|
Function ReadChar : Char;
|
||||||
Function WriteChar (Ch: Char) : LongInt;
|
Function WriteChar (Ch: Char) : LongInt;
|
||||||
Procedure Status (Str: String);
|
|
||||||
|
|
||||||
Property SocketHandle : LongInt READ FSocketHandle WRITE FSocketHandle;
|
Property SocketHandle : LongInt READ FSocketHandle WRITE FSocketHandle;
|
||||||
Property PeerPort : LongInt READ FPort WRITE FPort;
|
Property PeerPort : LongInt READ FPort WRITE FPort;
|
||||||
|
@ -91,8 +87,6 @@ Implementation
|
||||||
{ TELNET NEGOTIATION CONSTANTS }
|
{ TELNET NEGOTIATION CONSTANTS }
|
||||||
|
|
||||||
Const
|
Const
|
||||||
MaxStatusText = 20;
|
|
||||||
|
|
||||||
Telnet_IAC = #255;
|
Telnet_IAC = #255;
|
||||||
Telnet_DONT = #254;
|
Telnet_DONT = #254;
|
||||||
Telnet_DO = #253;
|
Telnet_DO = #253;
|
||||||
|
@ -125,17 +119,12 @@ Begin
|
||||||
FTelnetServer := False;
|
FTelnetServer := False;
|
||||||
FDisconnect := True;
|
FDisconnect := True;
|
||||||
FHostIP := '';
|
FHostIP := '';
|
||||||
StatusUpdated := False;
|
|
||||||
|
|
||||||
SocketStatus := TStringList.Create;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Destructor TSocketClass.Destroy;
|
Destructor TSocketClass.Destroy;
|
||||||
Begin
|
Begin
|
||||||
If FDisconnect Then Disconnect;
|
If FDisconnect Then Disconnect;
|
||||||
|
|
||||||
SocketStatus.Free;
|
|
||||||
|
|
||||||
Inherited Destroy;
|
Inherited Destroy;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
@ -145,17 +134,9 @@ Begin
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TSocketClass.PurgeInputData;
|
Procedure TSocketClass.PurgeInputData;
|
||||||
//Var
|
|
||||||
// Buf : Array[1..1024] of Char;
|
|
||||||
Begin
|
Begin
|
||||||
// If FSocketHandle = -1 Then Exit;
|
|
||||||
|
|
||||||
FInBufPos := 0;
|
FInBufPos := 0;
|
||||||
FInBufEnd := 0;
|
FInBufEnd := 0;
|
||||||
|
|
||||||
// If DataWaiting Then
|
|
||||||
// Repeat
|
|
||||||
// Until ReadBuf(Buf, SizeOf(Buf)) <> 1024;
|
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TSocketClass.Disconnect;
|
Procedure TSocketClass.Disconnect;
|
||||||
|
@ -610,33 +591,4 @@ Begin
|
||||||
Result := Client;
|
Result := Client;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
Procedure TSocketClass.Status (Str: String);
|
|
||||||
Var
|
|
||||||
Res : String;
|
|
||||||
Begin
|
|
||||||
If SocketStatus = NIL Then Exit;
|
|
||||||
|
|
||||||
Try
|
|
||||||
If SocketStatus.Count > MaxStatusText Then
|
|
||||||
SocketStatus.Delete(0);
|
|
||||||
|
|
||||||
Res := '(' + Copy(DateDos2Str(CurDateDos, 1), 1, 5) + ' ' + TimeDos2Str(CurDateDos, False) + ') ' + Str;
|
|
||||||
|
|
||||||
If Length(Res) > 74 Then Begin
|
|
||||||
SocketStatus.Add(Copy(Res, 1, 74));
|
|
||||||
|
|
||||||
If SocketStatus.Count > MaxStatusText Then
|
|
||||||
SocketStatus.Delete(0);
|
|
||||||
|
|
||||||
SocketStatus.Add(strRep(' ', 14) + Copy(Res, 75, 255));
|
|
||||||
End Else
|
|
||||||
SocketStatus.Add(Res);
|
|
||||||
Except
|
|
||||||
{ ignore exceptions here -- happens when socketstatus is NIL}
|
|
||||||
{ need to review criticals now that they are in FP's RTL}
|
|
||||||
End;
|
|
||||||
|
|
||||||
StatusUpdated := True;
|
|
||||||
End;
|
|
||||||
|
|
||||||
End.
|
End.
|
||||||
|
|
Loading…
Reference in New Issue