Solved

winsock connect-disconnect prob

Posted on 1997-11-28
1
292 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
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 viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

635 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