Solved

Help with Winsock Control

Posted on 2002-07-15
7
191 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.

746 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

14 Experts available now in Live!

Get 1:1 Help Now