🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.comp.programming
3 messages
3 total messages Started by JP Sat, 17 Feb 2001 18:14
TNMMSG component can't change IP at runtime?
#29
Author: JP
Date: Sat, 17 Feb 2001 18:14
23 lines
2892 bytes
I've got the following problem :

I've spent the last few days creating a little chat-program for our own LAN.
It seems to work quite well, but only when I'm still using the IP-adress
that's been set at design-time. After I've changed the IP at runtime, it
won't work anymore. I change the IP via a string which contains the dotted
IP-adress, thus which contains something like "192.168.0.5". I've verified
that the IP-adress is right, and that the component has recyved the new IP
adress correctley (  did a Memo -> Lines -> Add ("(" + MessageClient -> Host
+ ")");  ). I've tried out the app with IP-adresses set at desgn-time over
my LAN, that works. As soon as I change the adress at runtime, even if it is
the same adress as the one which I set at design-time, it won't work
anymore. I've made a keypressed event so that whenever a user types a
sentence and presses enter, the typed sentence is sent to the server. After
I changed the IP-adress, the first time I press enter, the server just
doesn't recyve the message. The next time the client gives the error
"Already connected", and then the program stops responding. I have to kill
it using CTRL + ALT + DEL. Does anyone know what I'm doing wrong? I've read
that the Host property can be set at runtime... What's going on?

Thanks,

JP
Re: TNMMSG component can't change IP at runtime?
#25
Author: Zweater
Date: Wed, 28 Feb 2001 23:15
59 lines
4495 bytes
"JP" <jaapjp@hetnet.nl> schreef in bericht
news:elvlB4QmAHA.188@net037s.hetnet.nl...
> I've got the following problem :
>
> I've spent the last few days creating a little chat-program for our own
LAN.
> It seems to work quite well, but only when I'm still using the IP-adress
> that's been set at design-time. After I've changed the IP at runtime, it
> won't work anymore. I change the IP via a string which contains the dotted
> IP-adress, thus which contains something like "192.168.0.5". I've verified
> that the IP-adress is right, and that the component has recyved the new IP
> adress correctley (  did a Memo -> Lines -> Add ("(" + MessageClient ->
Host
> + ")");  ). I've tried out the app with IP-adresses set at desgn-time over
> my LAN, that works. As soon as I change the adress at runtime, even if it
is
> the same adress as the one which I set at design-time, it won't work
> anymore. I've made a keypressed event so that whenever a user types a
> sentence and presses enter, the typed sentence is sent to the server.
After
> I changed the IP-adress, the first time I press enter, the server just
> doesn't recyve the message. The next time the client gives the error
> "Already connected", and then the program stops responding. I have to kill
> it using CTRL + ALT + DEL. Does anyone know what I'm doing wrong? I've
read
> that the Host property can be set at runtime... What's going on?
>
> Thanks,
>
> JP

I've just got bcb 3 installed here - bcb4 not installed and bcb5 I got
doesn't have fastnet controls
Anyway, in bcb3 the component has a method called Abort. I suggest you call
this function
*before* you assign a new IP address.

I als have another suggestion: why not use the TClientSocket / TServerSocket
components.
They are really easy to use, and much more flexible than the fastnet msg
component.

Using that components, you can make / break a connection using Open() and
Close().
Make sure you close the connection first BEFORE changing the IP address.
All errors can be catched if you add a handler to the OnError event, after
you
add a line to a memobox or something set ErrorCode to 0 and you're done.

Sending text in the ClientSocket:
ClientSocket1->Socket->SendText("bla bla bla");

In the serversocket:
ServerSocket1->Socket->Connections[clientnumber]->SendText("bla bla bla");

Receiving: add a OnRead handler. Use something like
Memo1->Lines->Add( Socket->ReceiveText( ) );

   - Zweater -
Re: TNMMSG component can't change IP at runtime?
#26
Author: JP
Date: Fri, 02 Mar 2001 20:37
76 lines
4450 bytes
Thanks a lot!!!!!




Zweater <news_zweater@hotmail.com> schreef in berichtnieuws
3a9d86bd$0$13501@reader3...
> "JP" <jaapjp@hetnet.nl> schreef in bericht
> news:elvlB4QmAHA.188@net037s.hetnet.nl...
> > I've got the following problem :
> >
> > I've spent the last few days creating a little chat-program for our own
> LAN.
> > It seems to work quite well, but only when I'm still using the IP-adress
> > that's been set at design-time. After I've changed the IP at runtime, it
> > won't work anymore. I change the IP via a string which contains the
dotted
> > IP-adress, thus which contains something like "192.168.0.5". I've
verified
> > that the IP-adress is right, and that the component has recyved the new
IP
> > adress correctley (  did a Memo -> Lines -> Add ("(" + MessageClient ->
> Host
> > + ")");  ). I've tried out the app with IP-adresses set at desgn-time
over
> > my LAN, that works. As soon as I change the adress at runtime, even if
it
> is
> > the same adress as the one which I set at design-time, it won't work
> > anymore. I've made a keypressed event so that whenever a user types a
> > sentence and presses enter, the typed sentence is sent to the server.
> After
> > I changed the IP-adress, the first time I press enter, the server just
> > doesn't recyve the message. The next time the client gives the error
> > "Already connected", and then the program stops responding. I have to
kill
> > it using CTRL + ALT + DEL. Does anyone know what I'm doing wrong? I've
> read
> > that the Host property can be set at runtime... What's going on?
> >
> > Thanks,
> >
> > JP
>
> I've just got bcb 3 installed here - bcb4 not installed and bcb5 I got
> doesn't have fastnet controls
> Anyway, in bcb3 the component has a method called Abort. I suggest you
call
> this function
> *before* you assign a new IP address.
>
> I als have another suggestion: why not use the TClientSocket /
TServerSocket
> components.
> They are really easy to use, and much more flexible than the fastnet msg
> component.
>
> Using that components, you can make / break a connection using Open() and
> Close().
> Make sure you close the connection first BEFORE changing the IP address.
> All errors can be catched if you add a handler to the OnError event, after
> you
> add a line to a memobox or something set ErrorCode to 0 and you're done.
>
> Sending text in the ClientSocket:
> ClientSocket1->Socket->SendText("bla bla bla");
>
> In the serversocket:
> ServerSocket1->Socket->Connections[clientnumber]->SendText("bla bla bla");
>
> Receiving: add a OnRead handler. Use something like
> Memo1->Lines->Add( Socket->ReceiveText( ) );
>
>    - Zweater -
>
>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads