Solved

Help with Winsock Control

Posted on 2002-07-15
7
192 Views
Last Modified: 2013-11-13
Hello Experts:

What I actually need is some help with Winsock connection management.  I am working on an application that has some functionality similiar to ICQ or AIM.

I have a client application and server application and can successfully connect multiple clients to the application, but the problem i am having is managing who is connected to each instance of the Winsock control.

Does anyone have any suggestions on how to manage this, so when user A on Winsock(1) wants to send a message to user C on Winsock(3), this can be accomplished successfully.
0
Comment
Question by:escheider
  • 4
  • 3
7 Comments
 
LVL 2

Expert Comment

by:yongyih
ID: 7154570
How about create a two dimension array.
nick name and which winsock
user A , 1
user B , 2
user C , 3

when user send message, winsock will send "*user C*" in front of message.  e.g.  "*user C*Hi, how are you?"
then you will have a function to retrieve the 'user C' from message.

after that, use it to check the nick name in array and send to correct person.
0
 
LVL 4

Author Comment

by:escheider
ID: 7154577
I was thinking along those lines but won't that be tremendous overhead if say 100 people connect to the server?  

Also, what if user B drops out --  that would require some complex array management.
0
 
LVL 4

Author Comment

by:escheider
ID: 7154588
I think it would be slick to have it store the connection that the users are connected to, then that could be passed as a parameter..so

User(1)=UserA
User(2)=UserB

and the array element would indicate which Sock(x) that user is connected to...but seems like complex array management.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Accepted Solution

by:
yongyih earned 50 total points
ID: 7154633
If don't want to use array, how about using Microsoft Access to store those information?  A table with at least two fields.  one for nick name, another one for which winsock.(another field for status if you want ^_^)


when a connection fail/close, just delete that record for that instance of winsock.

when look for an user name/nick name, just search a record in table..

0
 
LVL 4

Author Comment

by:escheider
ID: 7154835
interesting thought.  Im actually using an Access database already to keep track of member names, so I'll give this a try.
0
 
LVL 2

Expert Comment

by:yongyih
ID: 7157311
have you solve your problem?? ^_^
0
 
LVL 4

Author Comment

by:escheider
ID: 7157328
yes it did...thanks for the quick and easy suggestion.  it works like a champ.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now