Author | Message | Time |
---|---|---|
TriCk | Hello, I've made a bot in vb6 and i find it easy using csb/winsock so ive decided to move onto vb.net is it possible to do the needed coding in vb.net for a successful bot? the winsock connection states etc? if so please explain. :-\ Thanks | June 12, 2003, 5:46 AM |
Grok | No. Microsoft decided that VB6 was too powerful, so part of the design philosophy that went into VB.NET was to reduce complexity at the cost of functionality. You can still make Windows forms and some file handling, but winsock communications was judged too advanced and removed from VB.NET. Send your complaints to Redmond, Washington. (j/k) | June 12, 2003, 10:07 AM |
Yoni | See MSDN for more info (System.Something.Other.Winsock, I think) | June 12, 2003, 12:10 PM |
banditxx99 | Check System.Net.Sockets namespace. You'll have to create your own timer to check for available data in the socket. | June 12, 2003, 2:12 PM |
Camel | [quote author=banditxx99 link=board=17;threadid=1617;start=0#msg12169 date=1055427166] You'll have to create your own timer to check for available data in the socket. [/quote] eww, there's no select()? | June 12, 2003, 9:39 PM |
K | Just because he doesn't mention it doesn't mean it doesn't exist. [code] public static void Socket::Select( IList checkRead, IList checkWrite, IList checkError, int microSeconds ); [/code] of course, I prefer TcpClient / NetworkStream classes | June 12, 2003, 9:50 PM |
banditxx99 | I usually set up a timer and check the Available property on the socket, if it's > 0, I go get the data. Would Select forgo the need for a timer somehow? I checked out TcpClient class.. what's the advantage? Since you still have to convert to/from a byte array anyway, why not use the socket class directly? | June 13, 2003, 3:28 AM |
Skywing | [quote author=banditxx99 link=board=17;threadid=1617;start=0#msg12234 date=1055474909] I usually set up a timer and check the Available property on the socket, if it's > 0, I go get the data. Would Select forgo the need for a timer somehow? I checked out TcpClient class.. what's the advantage? Since you still have to convert to/from a byte array anyway, why not use the socket class directly? [/quote]That severely limits response times to incoming data - effectively, you're imposing a minimum of (timer delay) latecy on responses to anything. Depending on your timer interval, you're either going to be wasting a lot of processor time or noticibly impacting performance. Win32 is a preemptive multitasking environment; you let the system know that you want to be informed of certain events and allow it to notify you of them, rather than constantly (or periodically) polling for them. Select typically allows you to block thread execution until a) the specified timer interval elapses, or b) one or more of the events you elected to be notified about occurs. During this wait time, the thread consumes [u]zero[/u] processor time, and the system can [u]promptly[/u] wake and resume execution for your thread as soon as said event(s) happen. | June 13, 2003, 4:55 AM |
K | I don't have a problem dealing with byte arrays, but if you want to read / write strings, you can use the StreamReader / StreamWriter. [code] using System.IO; using System.Net.Sockets; // ... TcpClient t = new TcpClient(); StreamWriter s; try { t.Connect( /* .... */ ); s = new StreamWriter(t.GetStream(), /* character encoding, etc*/); s.AutoFlush = true; s.Write("hello remote host"); } catch(Exception ex) } Console.WriteLine(ex.ToString()); }[/code] | June 13, 2003, 4:19 PM |