Hello Ronaldo,

oke we are getting somewhere :)

> procedure TForm3.SocketSessionClosed(Sender: TObject; ErrCode: Word);
> begin                           {this  is Socket = TWSocket}
> memo1.lines.add('Proxy Disconnected from Server!');
> memo1.lines.add( Format('Error %d on SocketSessionClosed', [GetLastError])

You dont' need to call the last error from windows. you have an ErrCode
argument. So pleas change this to:

 memo1.lines.add( Format('Error %d on SocketSessionClosed', [ErrCode])

also in al the other events is an ErrCode argument, so log this
everyware during development.

> only here i got error : "Error 5 on SocketSessionClosed"

As Arno already say: Sounds like the Windows system error code
"ERROR_ACCESS_DENIED" but this is probably somewhere in your code and
possible also the reason for a winsock failure.

> its closes on Socket.Receive
> in packet log i see: Proxy Read from server -1 bytes <--this is
> socket.Receive (TWsocket)

Put a try / except block in the Receeive event. Possible you have an
exception over there and the reason for the close.

Also for the moment do the same in all events an also in all events log
the ErrorCode argument as in my example.

> sory for my poor English.

No probelm at all :)

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Friday, May 1, 2009, 16:20, Ronaldo DeVinche wrote:

> *I don't see anywere in your code logging of the ErrCode argument in the
> TWSocket events! So it is not sure where you get the error 5*

> procedure TForm3.SocketSessionClosed(Sender: TObject; ErrCode: Word);
> begin                           {this  is Socket = TWSocket}
> memo1.lines.add('Proxy Disconnected from Server!');
> memo1.lines.add( Format('Error %d on SocketSessionClosed', [GetLastError])
> );
> ClientConnected:= False;
> end;

> only here i got error : "Error 5 on SocketSessionClosed"
> Only this socket closes.

> LocalClient (TWSocketClient) is still connected to server (TWServerSocket)

> *
> I see you have a procedure ServerDataAvailable. Is this handler assigned
> to the OnDataAvailable of TWSocketServer? If so this is wrong. The
> serversocket will not receive data.

> LocalClient is assigned in Server.OnClientConnect. That is good if you
> use only 1 connection simultanously but if a second connection is
> etablished you loose the original reference to it.*

> well.. i still only lierning delphi
> and this was only way that i can figure out to get all this work

> dont have an idea how to do this in other way..

> *I already asked this, but again: witch socket does the close? And as
> additional question, when does it close (when sending, receiving etc)?*

> Closes only Socket (TWsocket)
> LocalClient Socket (TWSocketClient) is still connected to Server
> (TWsocketServer)

> its closes on Socket.Receive
> in packet log i see: Proxy Read from server -1 bytes <--this is
> socket.Receive (TWsocket)
> in error log i see: Error 5 on SocketSessionClosed  <-this is socket
> (TWsocket)

> PS.
> sory for my poor English.

> PSS.
> Thanks for your time

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to