"labeling" socket connections
"labeling" socket connections
"labeling" socket connections
"labeling" socket connections
"labeling" socket connections
"labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections
"labeling" socket connections "labeling" socket connections
"labeling" socket connections
Go Back  Xtreme Visual Basic Talk > > > "labeling" socket connections


Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2003, 01:13 PM
ValiantKhan's Avatar
ValiantKhan ValiantKhan is offline
Centurion
 
Join Date: May 2002
Location: Indiana, USA
Posts: 174
Default "labeling" socket connections


Yo, i've run into a lil problem i didn't really think of before. I have a server that recieves strings from the client and then it does what the client says then sends back the info the client requested. But how do I know which socket to send it back to if i have like 50 sockets connected. You guys have any idea on a way to label the sockets so I can say "okay, this goes to John on socket # 58, this one goes to Joe on socket # 3" etc etc.

I thought of maybe making a table in my SQL DB ( i use the DB throughtout my entire app.) and just putting the guys Username and IP address along with the socket #, so i can just call it up when i need to send something to specific users. But I wanted to see if you all had any other easier ideas.

Thanks for any help, advice, suggestions, etc.

--Val
__________________
She started playing with my floppy, and my hard drive downloaded.
Reply With Quote
  #2  
Old 02-17-2003, 01:32 PM
AtonalPanic AtonalPanic is offline
Contributor
 
Join Date: Jul 2002
Location: Houston, Texas
Posts: 445
Default

The database idea should work, but remember to update the tables as the user connects and disconnects. Also IP address aren't the best way to go unless everyone has a static IP, most of our IPs change whenever we connect to the internet(modem users), or the power goes out in our routers.
Reply With Quote
  #3  
Old 02-17-2003, 02:33 PM
lighth7015 lighth7015 is offline
Regular
 
Join Date: Feb 2003
Location: Tampa/St. Pete- you aint
Posts: 71
Default

eep! Lets try that again

how about writing the socket handle, or whatnot to the database along with the IP...that way, you can say something like:
Code:
public declare function senddata lib "ws32.dll" (blah as string, blah as long, wParam as long) Private Sub wsa_incoming(wParam as long, hMesg as long) retval% = senddata(DLookup("[wParam]","[tblUserInfo]","[IP_Address] = '" & getIPFromSocket(sockvar_goeshere) & "'),"here's the data you requested" & vbCrlf) End Sub


- Robert Butler
__________________
-- Robert Butler
http://www.abyssnet.org
robert_@abyssnet.org

Last edited by lighth7015; 02-17-2003 at 02:41 PM.
Reply With Quote
  #4  
Old 02-17-2003, 02:34 PM
GavinO's Avatar
GavinO"labeling" socket connections GavinO is offline
Coder of Fortune

Retired Leader
* Expert *
 
Join Date: Dec 2002
Location: Troy, NY USA
Posts: 3,120
Default

Indeed. The database system seems good. But why do you need to store the IPs? The socket holds onto those for you, and they are liable to change as often as the socket index.
__________________
-- The Gavster
Like to IRC? Try irc.randomirc.com
GavServer
Reply With Quote
  #5  
Old 02-17-2003, 02:44 PM
lighth7015 lighth7015 is offline
Regular
 
Join Date: Feb 2003
Location: Tampa/St. Pete- you aint
Posts: 71
Default

Quote:
Originally posted by GavinO
Indeed. The database system seems good. But why do you need to store the IPs? The socket holds onto those for you, and they are liable to change as often as the socket index.
Well you would store IPs as a means of retrieving the correct
information kept in the database...you basis the search using the
IP as the criteria for finding the correct socket. That way, it gets
to the intended source EVERY time.

Basically, you'd say:
"Find the socket handle for the person who's IP is..."
and there you have it, the correct socket handle, this time, and every time.
- Robert Butler
__________________
-- Robert Butler
http://www.abyssnet.org
robert_@abyssnet.org
Reply With Quote
  #6  
Old 02-17-2003, 03:25 PM
ValiantKhan's Avatar
ValiantKhan ValiantKhan is offline
Centurion
 
Join Date: May 2002
Location: Indiana, USA
Posts: 174
Default

w00t, thanks for the reply's guys. I think i'm gonna go with the Database idea.

Do you think just searching through the table for the guys Username then looking at the corresponding socket # would work?

Ahh but then there's also the fact that whether the user is online or offline.. i could maybe add a field to check whether it's online or offline before i check to socket #.

Hmm, any other ideas?

Thanks!

--Val
__________________
She started playing with my floppy, and my hard drive downloaded.
Reply With Quote
  #7  
Old 02-17-2003, 03:50 PM
lighth7015 lighth7015 is offline
Regular
 
Join Date: Feb 2003
Location: Tampa/St. Pete- you aint
Posts: 71
Default

Quote:
Originally posted by ValiantKhan
w00t, thanks for the reply's guys. I think i'm gonna go with the Database idea.

Do you think just searching through the table for the guys Username then looking at the corresponding socket # would work?

Ahh but then there's also the fact that whether the user is online or offline.. i could maybe add a field to check whether it's online or offline before i check to socket #.

Hmm, any other ideas?

Thanks!

--Val
That might work if you approach it from a different angle, but it
might not work all TOO well for your purposes, I'd just go and
look-up the guy's IP address and see what socket handle is
associated with it. BTW- add a temp record for everyone who
connects initially, and then go find they're username and write the
data there once they ID, so you can keep tabs on who's associated with what the socket handle when he
authenticates himself, no-use trying to guess who the owner of a
socket-handle is...now is there?

- Robert Butler
__________________
-- Robert Butler
http://www.abyssnet.org
robert_@abyssnet.org
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
"labeling" socket connections
"labeling" socket connections
"labeling" socket connections "labeling" socket connections
"labeling" socket connections
"labeling" socket connections
"labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections "labeling" socket connections
"labeling" socket connections
"labeling" socket connections
 
"labeling" socket connections
"labeling" socket connections
 
-->