Article View: alt.comp.programming
Article #26Re: TNMMSG component can't change IP at runtime?
From: JP
Date: Fri, 02 Mar 2001 20:37
Date: Fri, 02 Mar 2001 20:37
76 lines
4450 bytes
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 -
>
>
Technical Details
Message-ID:
<uOFsjj1oAHA.243@net005s.hetnet.nl>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!news3.bellglobal.com!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!npeer.kpnqwest.net!news2.kpn.net!news.kpn.net!master.news.hetnet.nl!news2.hetnet.nlReferences:
<elvlB4QmAHA.188@net037s.hetnet.nl> <3a9d86bd$0$13501@reader3>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8d38,3018f1587c24d03a X-Google-Attributes: gidf8d38,public X-Google-Thread: 10640b,3018f1587c24d03a X-Google-Attributes: gid10640b,public X-Google-Thread: 10fbec,3018f1587c24d03a X-Google-Attributes: gid10fbec,public X-Google-Thread: feb9e,3018f1587c24d03a X-Google-Attributes: gidfeb9e,public X-Google-Thread: 10dce5,3018f1587c24d03a X-Google-Attributes: gid10dce5,public X-Google-Thread: 10a78a,3018f1587c24d03a X-Google-Attributes: gid10a78a,public X-Google-Thread: 102541,3018f1587c24d03a X-Google-Attributes: gid102541,public X-Google-Thread: 103c8d,3018f1587c24d03a X-Google-Attributes: gid103c8d,public X-Google-ArrivalTime: 2001-03-02 12:44:25 PST From: "JP" <jaapjp@hetnet.nl> References: <elvlB4QmAHA.188@net037s.hetnet.nl> <3a9d86bd$0$13501@reader3> Subject: Re: TNMMSG component can't change IP at runtime? Date: Fri, 2 Mar 2001 21:37:58 +0100 Lines: 78 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: <uOFsjj1oAHA.243@net005s.hetnet.nl> Newsgroups: alt.comp.programming,alt.support.programming,borland.public.cpp.ide,borland.public.cpp.language,borland.public.cppbuilder.ide,borland.public.cppbuilder.language,borland.public.cppbuilder.students,forum.advanced.programming NNTP-Posting-Host: ipd54b5faf.free.wxs.nl 213.75.95.175 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!news3.bellglobal.com!sunqbc.risq.qc.ca!cpk-news-hub1.bbnplanet.com!news.gtei.net!npeer.kpnqwest.net!news2.kpn.net!news.kpn.net!master.news.hetnet.nl!news2.hetnet.nl