Solved

winsock connect-disconnect prob

Posted on 1997-11-28
1
291 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

710 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