Author | Message | Time |
---|---|---|
Gangz | Winsock and myself have really never gotten along, so using arrays is something that I cannot grasp. I have read up a little on what I could good, but almost everything I found was creating winsocks upon data requests. I am just trying to get a foundation to work off. The only thing I'm really positive of is the fact that I have to set the index on my original winsock to 0, and that i can do load winsock(# here) to create a new one. What if i want to create 200 arrays all connecting to different servers, How do I load everything from 0-200 havent to load each one separate? Will the inbound and outbound data stay separated between sockets on it's own or do i have to filter it in some way? How hard is it to incorporate in a program that is already made connecting 1 socket to a single server already? I'm sorry if this seems a little newbish, I just don't want to start off going in the wrong direction. Thanks in advance for any help. If anyone has a tutorial I would much appreciate something along those lines. | March 20, 2007, 10:06 AM |
TehUser | The easiest way to do this will be to do something like: [code] ' You could use a static variable for this, but whatever. Public WinsockCount As Integer Private Function InitVars() ' Assume you already have a winsock(0) on the form. WinsockCount = 1 End Function Public Function CreateNewWinsock(Optional ByVal Server As String = "SomeServer.com") ' Create the new Winsock control Load FormWhatever.winsock(WinsockCount) FormWhatever.winsock(WinsockCount).Connect(Server) WinsockCount = WinsockCount + 1 End Function [/code] Back on FormWhatever, you'll notice that the first parameter of all winsock events in now Index as Integer. This lets you determine which winsock control is calling the event, so to get properties or use methods, you can always do winsock(Index).whatever. | March 20, 2007, 4:40 PM |
Gangz | how do you kill all open sockets at 1 time? winsock(index).close? | March 20, 2007, 9:34 PM |
Barabajagal | a loop. [code] Dim I as Integer For I =Winsock.LBound to Winsock.UBound Winsock(I).Close Next I [/code] somethin like that. | March 20, 2007, 9:36 PM |
Gangz | Thanks for help guys. I now understand more then before, I have been fighting this all day. I guess ill play around with it a bit untill i get it. | March 21, 2007, 5:17 AM |