|
-
May 4th, 2003, 02:26 AM
#1
Thread Starter
Addicted Member
multiple sockets....like an array i guess...
im logging in a few names into a server so i want to setup , i guess i would be called a socket array....they sockets class im using is not a control....how bout some code to make an array...im going to have my names in a listview if that helps any....plus each name is gonna be sending different commands....so i would like u to show me how to identify and use each socket in the array bc i have never used arrays in any of my apps ....thx in advance 
AcE
-
May 4th, 2003, 10:14 PM
#2
Thread Starter
Addicted Member
maybe thats a bit confusing.....heres another question....i could make a loop threw all my items saying something like this.....but how could i do it....
dim lv_ids.items(itemnumber).text as new socketclient
AcE
-
May 5th, 2003, 01:56 AM
#3
yay gay
u cant give names at runtime like that..the best thing to do is just create a collection (arraylist or hashtable) and fill it up with all the sockets
\m/  \m/
-
May 5th, 2003, 06:16 AM
#4
Addicted Member
Hi,
I done a simmular thing in one of my projects.
What i did is created the ClientSocket class thats running at the server and a listener at server.
When a connection is made, a new instance of the ClientSocket is made and the new connection is linked to it.
Some handlers are added to control between the listener and client classes.
The client classes can be put into a hashtable or dictonary collection using the loginname as key (needs unique login names, and only allows a user to log in once).
If you want to send some data to all connected users, just use the enumerator to access all clients connected.
To send to 1 specified user, get the client class from the collection.
By using handlers and events again, a class can be removed from the collection when connection is closed.
-
May 5th, 2003, 06:34 AM
#5
yay gay
could i get those classes nightmare?
\m/  \m/
-
May 5th, 2003, 09:42 AM
#6
Thread Starter
Addicted Member
guess my situation is sortof like that.....i got like 30 connections to a specific server.....then maybe be connected to multiple servers....could some1 gimmie a brief example of using a collection of arrays....maybe how to assemble the collection and then how to do the socketclient.senddata for each item in the collection....and maybe how to get the data recieved....im having a hard time telling how to use arrays....i wuz doing vb6 befor .net but i never got around to arrays so i dont really understand them bc of my lack of experence......any help is better than none @ all...thx for ur help so far 
AcE
-
May 5th, 2003, 09:48 AM
#7
Thread Starter
Addicted Member
nm i found an example....heres the url if any1 wants it....its just wut i needed.....http://planet-source-code.com/vb/scr...52003104498834
thanks guyz
AcE
-
May 5th, 2003, 11:33 AM
#8
Addicted Member
Originally posted by PT Exorcist
could i get those classes nightmare?
Sure, i will look for the cd and put it online.
Its actuly an messenger program with server / client application.
you can connect and login to the server, but i never finished the rest of the commands and scripts.
But the serversided client classes are usefull.
I will also put an example serverclass with it that handles the incomming connections, closed connection and message responses.
If you are looking for examples, you can also find 1 in .NET itself, multisockets or something like thats, but it isnt so usefull, cause it only makes a connection and direcly closes it again.
Greets Nightmare 
---
ps: if somebody like to help to finish the messenger, it would be cool, its a simple messenger that doesnt has all the special features like icq, msn, .... so less command, less bugs and safer progam. I made it more for private use, so i want to put the application on my site so everybody can dowload for free, maybe even make the source available for in case people want to add theyre own functionality
-
May 5th, 2003, 12:21 PM
#9
yay gay
ah ok nightmare when u find it then post it here plz
\m/  \m/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|