[twsocket] subsequent sendstr not sending?

Allen A. Maxwell aamax@xmission.com
Tue, 27 Jun 2000 09:22:32 -0600


Thanks for your reply... Not sure you caught (or I explained well) what's
really going on.  Sounds like I may have to do some things differently.
Couldn't find a real good reason to use the TWSocketServer so I pretty much
duplicated the example I found using TWSocket on both client and server (and
the form that the server creates when it accepts the client).


> Max,
>
> Do you use TWSocket as listening serrver or TWSocketServer ?
> Anyway if you pass information with the client (initial login), you have
> already an accepted socket. Then you try to accept it again --> that's
what
> is wrong. The (accepted) socket where you do the initial login with the
> client is the one you have to use during the lifetime of the tcp session.
>

I only accept the connection once.  After the server creates the form that
has another socket component on it and calls  Form.CliSocket.HSocket :=
SrvSocket.Accept; all the communication occurrs on the form that the server
created which is how I thought things were supposed to work: the client
requests a connection from the server, the server accepts the connection and
creates a socket for the future communications to occur.  It just seems that
after the initial communications occur the next requests from the client are
lost in socket land...

I hope this is clearer.  Should I be using the TWSocketServer on the main
server form instead of TWSocket?  I just followed the demo example which
didn't use it...




> If you wants a separate form for each client you eather create the form
when
> new session is available, accept the socket and do the initial loging and
> the rest of the session, or accept the connection, do the initial login,
> then create the form and pass the same object handle to the form's socket.
>
>  Form := TfrmSRVClient.create(self);
>  ClientList.Add(Form);  // maintains a list of clients connected
>  Form.CliSocket := InitialSocket;
>  Form.Show;
>
> Where 'InitialSocket' is the socket you have accepted to do teh initial
> login.

hmm... the form has a TWSocket already on it which is why the call to
Form.CliSocket.HSocket := SrvSocket.Accept; is made in the server when the
client asks for a connection.  The code I posted in my origional post was in
the SessionAvailable event (I should have stated that before)...

Thanks again for the reply.

>
> rgds, Wilfried
>
> > -----Original Message-----
> > From: twsocket-admin@elists.org [mailto:twsocket-admin@elists.org]On
> > Behalf Of Allen A. Maxwell
> > Sent: dinsdag 27 juni 2000 2:01
> > To: twsocket@elists.org
> > Subject: [twsocket] subsequent sendstr not sending?
> >
> >
> >
> > HI all,
> >
> > I'm new to the list and new to the ICS controls.  Have written a
> > client and
> > server and am able to establish a connection.  After doing so I have the
> > client log in (send password and user name to server) which works
> > fine.  The
> > server sends back some information for the client to use in populating
the
> > form - all of this is fine.
> >
> > I used the demo to set things up and when the initial connection is made
I
> > create a new form with a socket on it and the communication to do
> > the above
> > stuff is done in this form...
> > (here's how I'm starting the connection form):
> >
> >     Form := TfrmSRVClient.create(self);
> >     ClientList.Add(Form);  // maintains a list of clients connected
> >
> >     Form.CliSocket.LineMode := TRUE;
> >     Form.CliSocket.LineEnd  := #13#10;
> >
> >     { Now accept the new client connection }
> >     Form.CliSocket.HSocket := SrvSocket.Accept;
> >     Form.Show;
> >
> > anyway, the probem comes now.. After the initial client form is
populated
> > the client takes some action and needs to pass some more info to
> > the server,
> > so the server can respond again.  I call sendstr on the client
> > again but it
> > never seems to get anywhere.  I've tried putting showmessage()
> > statements in
> > the events on the server (both the main form and the split off form) but
> > they never get called.  I'm sure this is due to something stupid
> > on my part
> > but if you all could be gentle enough (and bonk me on the head with the
> > answer) I'd really appreciate it!  :)
> >
> > Thanks in advance.
> >
> > Max
>
>
> _______________________________________________
> TWSocket mailing list [http://elists.org/mailman/listinfo/twsocket]
> Visit our website at http://www.rtfm.be/fpiette/indexuk.htm
>