Results 1 to 11 of 11

Thread: Winsock isnt working, help

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Winsock isnt working, help

    I cant find the winsock control in my VS anymore. I made an application with winsock while ago and I could see the winsock control on the toolbar. But for some reason it is not there anymore. I reinstalled VS, but that didn't help.
    When I open my old program which used winsock, I see the old vb6 winsock instead, and the task list shows this error too: Error reading resources from the resource file for the default culture: Invalid ResX input.
    plz help, I am lost!!
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    use the System.Net.Sockets namespace and the TcpClient and TcpListener classes.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx but why cant I see the winsock control?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    hellswraith
    Guest
    From what I understand it uses a lot more resources to use a COM control like the winsock compaired to classes that are in the framework. This is because it must create a wrapper class to hold the COM component from what I understand. It creates more overhead. The framework classes will be much faster.

  5. #5

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    but anyways, how do I get the poor old winsock control to work? I want to try working with the ActiveX version first, then maybe I'll try it with the framework thing that Cander said
    any ideas why it's not showing up in the components list?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6
    Frenzied Member Shawn N's Avatar
    Join Date
    Dec 2001
    Location
    Houston
    Posts
    1,631
    Here's an example I wrote a little while back.

    http://vbforums.com/showthread.php?s=&threadid=149015
    Please rate my post.

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    MrPolite your killing me.

    I hate brining up this arguement, but you really should do it the .NET way. Using COM give huge over-head(ok that sounded a bit dirty) and the app becomes unmanaged, meaning its not fully working under the framework anymore. It is just not smart to do something that is going to use up more memory when a much better way is included with the framework. Dont let bad habits form early.

    Let me show you why using COM causes the over head. When you add the reference to an COM component in Visual Studio, it creates a wrapper class. So what happens, when you call winsock methods it has to go through the wrapper dll it makes, then the winsock, then the winsock calls the apis, then api's do whatever with the OS. See all those steps? If you use the framework way, you have like 2 steps.

    I hope I am helping you understand why you really need to be learning the .NET classes and not trying to use all your old COM components unless absolutly necessary.

    Finally as far as why winsock is not working anyway, as it it still should work, I really dont know. Like I said Visual Studio is supposed to create that wrapper dll, but I dont know what is causing that problem as it seems lots of people are having the same problem. Maybe its Microsoft's way of telling you 'What the hell do you think you are doing? use the System.Net.Sockets classes fool?'

    LOL


    Sorry to be so long winded, but it has been my quest to help people understand why they need to get off the COM ideology when switching to .NET. It is like buying a car with a high end CD player only to replace it with a crappy one!
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx a lot for putting time to write all that!!!!
    So it's always better to avoid activeX control?! goot to know

    Umm I have to give the .NET version a try and see if I can make it work

    besides winSock, what other common activeX controls are there that have a .NET version? when you say use the .NET version of it I think you mean to do these stuff for dialog box, winsock and those things. I cant do the same for listbox/textbox and stuff, right?

    I guess I'm really killing you this time
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  9. #9
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    yeah most everything you ever did before has a way to do it just using the framework classes. All the controls are(listbox,textbox,etc) are a part of the System.Windows.Forms namespace.


    That is what you need to understand and learn are these namespaces and how to use them..like for isntance, to create a new textbox on a form

    Public myBox As New System.Windows.Forms.TextBox
    ' set all properties you may want like text, size,etc.
    myBox.Text = "Click Me"
    yourform.Controls.Add(myBox)

    non visual controls are basically the same, except you dont add it to a form collection

    Public mySocket As New System.Net.Sockets.TcpClient
    mySocket.whatever = "blah"


    and so on...

    look at the post called silly api question for a link to a class browser and my tips on using wincv.exe to learn more about a specific class/object

    Finally here is a link to get you started on using the .NET socket stuff with code.

    http://msdn.microsoft.com/library/de...et08282001.asp
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  10. #10

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    tnx alo Cander
    But just to make you a little angrier... what's the use of IDE if you want to do everything with code?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  11. #11
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    To feel superior!

    Actually just think of the IDE as a luxury. Dont depend on it. You should know what is going on behind the scenes when you add a textbox, button, or whatever. Try learning how to create a windows form/size it/ location and put controls on it using just plain notepad and learn to use the comman line compiler vbc.exe. If you can do that, you have taken a big step in undestanding .NET programming better.

    Dont get me wrong and think I am telling you not to use the nice graphical IDE, im just saying you really need to know the code it creates also to really understand .NET. Sure it is great to just be able to drag and draw that button, but a monkey could do that!
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width