| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Please help with wins |
I think that is the key you need to close the port when the client closes
the connection
This is simple if it is a graceful close that is you use the close
connection method on the client app.
you can use the connection close event on the server.
but because TCP/IP is essentially a disconnected protocol if the client app
crashes the server only finds out that when it try's to send something to
the client when no response is received an error is raised so I normally
have some kind of a heart beat routine on the server just sending one byte
every few seconds to ensure the client is still there.
another way is to use a control array with the first Winsock control
listening and passing the connection request to a second new instance of the
control that way you are always listening for requests.
I have not had any issue with ports being blocked for two minutes.
there is good information at www.vbip.com
also search MSDN on the Winsock control they have a good example of the
control array version.
Good luck
"Steen Gellett" wrote in message
news:40b35cd6$0$175$edfadb0f{at}dread11.news.tele.dk...
>
> "Paul" skrev i en meddelelse
> news:ca236fb1.0405240659.59177c11{at}posting.google.com...
> > Hi,
> >
> > I want to develop two applications that will automatically begin to
> > talk to each other via winsock if they are both started up. I want to
> > develop it so that no timers are involved in initiating communication.
> > The way I thought it would work is that each application would have
> > three winsock controls on its form. On the form load event of both
> > applications, each would listen out on a different port for incoming
> > messages (e.g. A on 4000 and B on 4001). At the same time one of the
> > other winsock controls on each form would try to connect to the other
> > app on different ports. For example, in app A I might have
> >
> > wskListen.LocalPort = 4000
> > wskListen.Listen
> >
> > wskSend.RemotePort = 4001
> > wskSend.RemoteHost = "127.0.0.1"
> > wskSend.Connect
> >
> > and on app B I'd have
> >
> > wskListen.LocalPort = 4001
> > wskListen.Listen
> >
> > wskSend.RemotePort = 4000
> > wskSend.RemoteHost = "127.0.0.1"
> > wskSend.Connect
> >
> > (The third winsock control on each app is there to accept connection
> > requests so isn't important.)
> >
> > Depending on which app was started first there would always be an
> > application listening and when the other was started then there would
> > be a connection. On the connect event of that winsock control, I'd
> > send a message to the port on which the other application was
> > listening asking it to retry connecting. This works okay if I start
> > either app A or B first. However if I close one of the applications
> > and start it again connection is never reestablished. I get a
> > "Connection is aborted due to timeout or other failure"
error. I have
> > to end both applications in order for them to start communicating
> > again. Has anybody managed to achieve something like this.
> >
>
> First : Do you know that there is a 2 min "block" for that
port you just
> used !! Wait 2 minutes and then try again.........I havent found out why,
> neither do I have a solution.............
>
> Second : When you disconnect after first run, you must make sure that
> it closes all socket's on boot machines, and then starts listen again !!
>
>
>
> > Thanks,
> >
> > Paul
>
>
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com
---
* RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
* RgateImp.MoonDog.BBS at 5/28/04 7:48:41 AM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)SEEN-BY: 633/267 270 @PATH: 278/230 10/345 106/1 2000 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.