Re: [twsocket] TnEmulVT: Number Rows - Important!!!!

2005-09-07 Thread Steve Williams

Francois Piette wrote:

Yes, seem to be some communication problems.
I think he is looking for the telnet escape sequence to notify the server 
that the terminal size has changed.  Maybe it is in the telnet rfc, I'm not 
sure.



If that's the question, I don't know the answer. 
I was even not aware that such esc sequence existed !


Maybe it is this one.

Telnet Window Size Option
ftp://ftp.rfc-editor.org/in-notes/rfc1073.txt

--
Sly


This message and its attachments may contain legally privileged or confidential 
information. This message is intended for the use of the individual or entity 
to which it is addressed. If you are not the addressee indicated in this 
message, or the employee or agent responsible for delivering the message to the 
intended recipient, you may not copy or deliver this message or its attachments 
to anyone. Rather, you should permanently delete this message and its 
attachments and kindly notify the sender by reply e-mail. Any content of this 
message and its attachments, which does not relate to the official business of 
the sending company must be taken not to have been sent or endorsed by the 
sending company or any of its related entities. No warranty is made that the 
e-mail or attachment(s) are free from computer virus or other defect.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Re: [twsocket] Client/Server

2005-09-07 Thread Wilfried Mestdagh
Hello David,

Will try to check your code this evening. I cannot do real debug because
I only have Delphi, but I will check it. Some quick comments for now:

 co_ServerWinsockPort-ClientClass = __classid(TTcpSrvClient);

Did you did this line of code before you call Listen ? If yes then OK.

 Edit: I have just noticed that the reply received by the Client is a
 text string Welcome to TcpSrv.

Ok that explains the 19 bytes (the banner + \r\n).

 And where is my data?

Good question :( You send binary data I think. You dont have LineMode
set to True at client ? Eventually you download SocketSpy from user
made, set it to 'debugstring' and you can watch what is transmitted.

 I am using -Send, not -SendStr.

Is same. SendStr call Send.

 Another thing I currently have is that the Client/Server connection 
 works first time every time. However, after the first transaction, the
 client cannot connect again event though I finished the transaction with
 Close.

You did not used Close from one of the TWSocket events ? If you do then
call CloseDelayed.

---
Rgds, Wilfried
http://www.mestdagh.biz

Wednesday, September 7, 2005, 10:58, David Lewis wrote:

 Thanks for your reply, but it hasn't made any progress for me.

 Adding:

 co_ServerWinsockPort-ClientClass = __classid(TTcpSrvClient);

 Had no effect at all(!) to what I was seeing.

 I have now seperated my code into client and server to try and make
 it easier for me to find out what is happening and added event logs as
 a means to debug it.

 What I have found so far (for events) is:


 
 ClientServerRemote Client
 
-Connect 
   OnClientConnect
   -Create Socket
 OnDataSent
 OnDataSent
 OnSessionConnected
-Send
 me_ClientDataSent
 OnDataAvailable
 -Receive
 -Send (reply)
 OnDataAvailable
-Close
   OnClientDisconnect
 OnSessionClosed   
 

 Note: The 'remote client' is the socket created by the server when the
 client connects.


 Currently, I have it so that the client sends 10 data bytes, and the 
 server will reply with 8 data bytes.
 The server picks up the 10 bytes correctly, and claims to reply with the 8.

 However, the client apparently receives 19 bytes in reply, none of which
 seem to be the 8 that the server has sent!

 Edit: I have just noticed that the reply received by the Client is a 
 text string Welcome to TcpSrv. Is this normal? And where is my data? I
am using -Send, not -SendStr.

 Another thing I currently have is that the Client/Server connection 
 works first time every time. However, after the first transaction, the
 client cannot connect again event though I finished the transaction with
-Close.



 Any ideas?

 Source code attached (Borland C++ Builder).



 Dave





 Wilfried Mestdagh wrote:

Hello David,

You have a class TTcpSrvClient, whitch is derrived from TWSocketClient
class, but I dont see you assigning this class to the server component:

  co_ServerWinsockPort-ClientClass = TTcpSrvClient;

You assign event handler to OnError. This is not good, you better work
with your own try / catch handling to find out if and where some
exception should occure. For example you should have one in the Listen
method, and whilst developping at least in all events.

You send buffer, that's OK, but be aware that TCP is not boundary safe,
you can send 1000 bytes and receive 2 chunck of 500, or you can send 2
times 1000 bytes and it is possible you receive as first packet 1500
bytes. So you have to be prepared for that.

---
Rgds, Wilfried
http://www.mestdagh.biz

Tuesday, September 6, 2005, 13:39, David Lewis wrote:


Ok, so expanding a little on what I have:


The components are dynamically created:


TWSocket  *co_ClientWinsockPort;
TWSocketServer*co_ServerWinsockPort;


at_TargetIpAddress = 192.168.0.42;
// Client TCP Comms Component
co_ClientWinsockPort= new TWSocket(NULL);
co_ClientWinsockPort-Port  = 1001;
co_ClientWinsockPort-Proto = tcp;
co_ClientWinsockPort-Addr  = at_TargetIpAddress;
co_ClientWinsockPort-OnSessionConnected= me_ClientSessionConnected;
co_ClientWinsockPort-OnDataAvailable   = me_ClientDataAvailable;
co_ClientWinsockPort-OnError   = me_ClientError;


// Server TCP Comms Component
co_ServerWinsockPort= new TWSocketServer(NULL);
co_ServerWinsockPort-Port  = 1002;
co_ServerWinsockPort-Proto = tcp;
co_ServerWinsockPort-Addr  = 

Re: [twsocket] Client/Server

2005-09-07 Thread David Lewis
Further investigation has solved a few things...

I was getting a ltitle confused by the data being sent by the component, 
and not by me. I wasn't expecting this data Welcome to TcpSrv so 
wasn't ready to handle it.

I was also a little off-target by expecting my data to be sent at the 
time I used the Send( ) method. I forgot about the MCU and that data 
isn't sent until the buffers were full.

So...

I now am using :
TWSocketOptions( )  wsoTcpNoDelay;
To get the data sent when I need it sent (I am using very small messages)

I now accept the Welcome to TcpSrv message and ignore it, waiting for 
the real data to be recevied.

Once everything is complete, I call Close( ) on the client.


The other problem I was having (Second time round failure to connect) 
was because I was resetting the Addr  Port before the Send( ) method 
and not before the Connect( ) method. Now things seem to be working 
fine, although I am getting some extraneous OnDataSent  OnDataAvailable 
calls that I don't fully understand.


Is there a guide to what calls should happen when based on the 
components? As in the correct sequence on Event calls for when Client 
connects  disconnects?
I'm guessing that certain information is being sent by the component on 
connectino  disconnection which is causing these extra events to 
happen, but I would like to understand them so I can handle them properly.

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


Re: [twsocket] Client/Server

2005-09-07 Thread Wilfried Mestdagh
Hello David,

Glad it works for you now :)

 and not by me. I wasn't expecting this data Welcome to TcpSrv so

You can switch this off if you want. Just before you call Listen you do:
  Srv.Banner := '';

 isn't sent until the buffers were full.
 TWSocketOptions( )  wsoTcpNoDelay;

Not needed. Nagle algoritm just wait some milliseconds to send just in
case tehre is something else to send. I recall typically 100 ms.
Switching off nagle will let your data send a little faster but it slow
down network performance.

 fine, although I am getting some extraneous OnDataSent  OnDataAvailable

I dont understeand. Can you please reprase ?

 Is there a guide to what calls should happen when based on the
 components?

Not a real guide, but please check on my site the FAQ and the HELP
documents for TWSocket.

 I'm guessing that certain information is being sent by the component on
 connectino  disconnection which is causing these extra events to 
 happen, but I would like to understand them so I can handle them properly.

There is no extra data sent by the component. TWSocket does not add
anything to your data. Events are fired as follow (client side) when you
call Connect:

- OnSessionConnected (eventually with winsock error).
- OnSessionClosed (if OnSessionConnected has error) (eventually with
  winsock error).
- OnDataAvailable (but nothing to receive, but depending on OS)

Then session is started.

---
Rgds, Wilfried
http://www.mestdagh.biz

Wednesday, September 7, 2005, 14:58, David Lewis wrote:

 Further investigation has solved a few things...

 I was getting a ltitle confused by the data being sent by the component,
 and not by me. I wasn't expecting this data Welcome to TcpSrv so 
 wasn't ready to handle it.

 I was also a little off-target by expecting my data to be sent at the 
 time I used the Send( ) method. I forgot about the MCU and that data 
 isn't sent until the buffers were full.

 So...

 I now am using :
 TWSocketOptions( )  wsoTcpNoDelay;
 To get the data sent when I need it sent (I am using very small messages)

 I now accept the Welcome to TcpSrv message and ignore it, waiting for
 the real data to be recevied.

 Once everything is complete, I call Close( ) on the client.


 The other problem I was having (Second time round failure to connect) 
 was because I was resetting the Addr  Port before the Send( ) method 
 and not before the Connect( ) method. Now things seem to be working 
 fine, although I am getting some extraneous OnDataSent  OnDataAvailable
 calls that I don't fully understand.


 Is there a guide to what calls should happen when based on the 
 components? As in the correct sequence on Event calls for when Client 
 connects  disconnects?
 I'm guessing that certain information is being sent by the component on
 connectino  disconnection which is causing these extra events to 
 happen, but I would like to understand them so I can handle them properly.

 Dave

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


Re: [twsocket] 64-bit FTP support

2005-09-07 Thread Dan
- Original Message - 
From: Angus Robertson - Magenta Systems Ltd [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Wednesday, September 07, 2005 12:53 AM
Subject: Re: [twsocket] 64-bit FTP support


 Are you sure you were using soBeginning, soEnd etc. instead of
 soFromBeginning, soFromEnd.
 I had this problem when I started using int64 streams and that was the
 solution.

 These have the same numeric values so should not make any difference to
 how the stream is used.

 soFromBeginning = 0; soFromCurrent = 1; soFromEnd = 2;
 TSeekOrigin = (soBeginning, soCurrent, soEnd);

 My problem was that although code insight suggests the Int64 version
 was being called, there was a range error as soon as the offset
 exceeded a longint, so the compiler must have been used the longint
 version.

 function Seek(Offset: Longint; Origin: Word): Longint; overload; virtual;
 function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override;

One uses a Word for the origin, one uses a TSeekOrigin.  If you pass 
soFromBeginning, its a word so it uses the Longint version.  If however you 
pass soBeginning, it is a TSeekOrigin so it uses the Int64 version. At least 
in my experience.  I think it should be better documented.

Dan 

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