[twsocket] Newbie problems with TWSocket. (balbaro)

2007-05-20 Thread balbaro

- Original Message - 
From: [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Sunday, May 20, 2007 2:00 PM
Subject: TWSocket Digest, Vol 220, Issue 10
Hello,

Thanks very much for the reply and help.

So i understand...

Assumed the sever is listening...
In tcp proto.

1) connect the client
2) in Client.SessionConnected event : send the string
3) In Client.Datasent event : client.closedelayed

But then for a response
Is this correct ?

1) In server.DataAvailable event : server : ClientServer.sendstring 
response;
2) In Server : ClientServer.Datasent event : 
server.clientserver.closedelayed


balbaro





 Send TWSocket mailing list submissions to
 twsocket@elists.org

 To subscribe or unsubscribe via the World Wide Web, visit
 http://www.elists.org/mailman/listinfo/twsocket
 or, via email, send a message with subject or body 'help' to
 [EMAIL PROTECTED]

 You can reach the person managing the list at
 [EMAIL PROTECTED]

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of TWSocket digest...


 Today's Topics:

   1. Newbie problems with TWSocket. (balbaro)
   2. Re: Newbie problems with TWSocket. (Francois PIETTE)
   3. Re: HTTPCli and proxy settings (Dod)
   4. sending long strings? ([EMAIL PROTECTED])
   5. Re: Newbie problems with TWSocket. (Wilfried Mestdagh)
   6. Re: sending long strings? (Wilfried Mestdagh)


 --

 Message: 1
 Date: Sat, 19 May 2007 19:15:25 +0200
 From: balbaro [EMAIL PROTECTED]
 Subject: [twsocket] Newbie problems with TWSocket.
 To: twsocket@elists.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=us-ascii; format=flowed

 Hello all,

 I'm puzzled to find out what i'm doing wrong.


 I made a component with both the TWsocketserver and A TWsocket as client
 to be used in a app.

 Server is running.

 Can i connect and send a string in the same event ?

 For example :

 client.connect

 wait for state connected

 sendstring

 close socket


 Linemode := true and i added the endofline chars to the string.

 Is this the correct method ?

 Why is the first string always 'Server Ready ?


 balbaro





 --

 Message: 2
 Date: Sat, 19 May 2007 21:20:33 +0200
 From: Francois PIETTE [EMAIL PROTECTED]
 Subject: Re: [twsocket] Newbie problems with TWSocket.
 To: ICS support mailing twsocket@elists.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; format=flowed; charset=iso-8859-1;
 reply-type=original

 I'm puzzled to find out what i'm doing wrong.
 I made a component with both the TWsocketserver
 and A TWsocket as client to be used in a app.

 Server is running.

 Can i connect and send a string in the same event ?

 No. ICS is asynchronous. Calling Connect is just a reauest to connect. You
 get control back from connect almost i;;ediately while the connection take
 place in the background. When the connection finally establish (or fails
 to), the event OnSessionConnected is triggered. You can start sending from
 that event handler, or later.

 For example :
 client.connect
 wait for state connected

 You never wait for state connected. You write the code you need to do when
 connected in the OnSessionConnected event hanlder, just like you never 
 wait
 for the user to click on a button but you write the code to be done when 
 the
 button is clicked in the OnClick event handler.

 sendstring
 close socket

 Here again, Send is non blocking. It returns i;;ediately while sending 
 take
 place in the background auto;atically. Data is buffered by TWSocket. When
 buffer has been emptyed, you have OnDataSent event triggered. You can call
 close fro; there, or even better Shutdown to gracefully break the
 connection.

 Linemode := true and i added the endofline chars to the string.
 Is this the correct method ?

 Line:ode only influence receiving: Co;plete lines are assembled before
 triggering OnDataAvailable event. When sending the component send exactly
 what you asked. You have to add yourself the end of line string if you 
 want
 this to be sent.

 Why is the first string always 'Server Ready ?

 Not sure I understand. Please clarify.

 [EMAIL PROTECTED]
 The author of the freeware multi-tier middleware MidWare
 The author of the freeware Internet Component Suite (ICS)
 http://www.overbyte.be


 --

 Message: 3
 Date: Sun, 20 May 2007 00:46:07 +0200
 From: Dod [EMAIL PROTECTED]
 Subject: Re: [twsocket] HTTPCli and proxy settings
 To: ICS support mailing twsocket@elists.org
 Message-ID: [EMAIL PROTECTED]
 Content-Type: text/plain; charset=us-ascii

 Hello Arno,

 Ouch...true ! I downloaded it 20 dec 2006 but forgot to install it !

 regards.


 AG Dod wrote:
 Hello Arno,

 I don't have OverbyteIcsWinsock2.pas unit in my ICS V6 installation...

 AG Then you are using an old version. The unit also includes a function
 AG to get systems interface list easily.

 AG --
 AG Arno Garrels [TeamICS

Re: [twsocket] Newbie problems with TWSocket. (balbaro)

2007-05-20 Thread Wilfried Mestdagh
Hello Balbaro,

 1) connect the client
 2) in Client.SessionConnected event : send the string
 3) In Client.Datasent event : client.closedelayed

No. This will not garantie that the data is arrived by the server. You
can make a protocol for it, so that the server send back ACK after it
has handled the data. Then close the connection. You can also call
Shutdown(1). This will send a close request to the other end. The close
request will arrive after the data of course, then the other end can
close it.

 1) In server.DataAvailable event : server : ClientServer.sendstring
 response;
 2) In Server : ClientServer.Datasent event : 
 server.clientserver.closedelayed

You only have to close 1 side of the connection. The other side will
close also. Again OnDataSent is not at arrival time, it is fired when
TWSocket has given all data to winsock. As said you can use Shutdown(1)
but only at one end, that is the end that sends the last time and does
not expect a responce anymore.

Also a proto is easy to implement. If you have ascii data you can make
the proto in ascii as whell using LineEnd. But I dont know your
application of course.

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

-- 
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] Newbie problems with TWSocket. (balbaro)

2007-05-20 Thread Francois PIETTE
 But then for a response
 Is this correct ?

 1) In server.DataAvailable event : server : ClientServer.sendstring
 response;
 2) In Server : ClientServer.Datasent event :
 server.clientserver.closedelayed

It depends on the protocol you are designing.
Most protocols in use (FTP, SMTP, POP3 and more) are line oriented and use a 
command/response scheme:
1. The client connect
2. the sender send his welcome banner
3. the client send a command
4. the server send his reply
5. goto step 3 until client send hist quit command for which the server 
gracefuly close the connection.

--
[EMAIL PROTECTED]
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
-- 
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