Solved

winsock connect-disconnect prob

Posted on 1997-11-28
1
286 Views
Last Modified: 2013-11-13
1. I'm working on a little app, containing a server side and a client side. The clients must be able to connect and disconnect, and connect again.
The first connect works fine, but after disconnecting, a second connect seems impossible, I keep getting the 'adress in use' error on the client side.

to connect I use : tcpclient.connect <hostname> <port>
to disconnect : tcpclient.close

anyone got a clue ?

2. I test this app with two clients on one machine. But it seems that when I let the server send something to all connected clients, it only gets to the last connected client. I read in some news groups that this prob is known, and that it should work fine when using it in a real network setup. Can anyone confirm this ?

Tnx
Christophe VG
0
Comment
Question by:tofke
1 Comment
 
LVL 8

Accepted Solution

by:
mrmick earned 100 total points
ID: 1442784
Bugs, don't ya just hate em?

The workaround:  Use a control array.

On the server side, when you accept a new socket, create a new socket by loading another object instance of the winsock control (Load tcpSocket(Index)) and accepting the connection with it, when it disconnects, you set it to nothing and unload it (Unload tcpSocket(Index)).

On the client side, draw socket1(0) on a form, but don't use it, load socket1(1) and use it til you disconnect, then unload it.  Repeat as necessary!

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question