USing Winsock in .net framework

i am currently doing a school project which requires me to convert embedded vb codes to .net framework. In embedded vb, the component WInsock was used. However in .net i was not able to find the component. Is winsock available in Visual Studio where i can drag and drop Are there other alternatives to using WInsock Please help. Thanks.


Answer this question

USing Winsock in .net framework

  • oag_hboyce

    Thanks for the reply. So is there any way to use the winsock component in .Net framework

  • .NetProgrammer

    Thanks for the advices. However i am stuck in this one area, when I used the emulator and type the computer ip, it works perfectly, but when i deploy it in the pocket pc, and used the same ip, it states the " No such host is known". I have no idea what causes the problem even after searching around the Net the whole day. So any help by naming the possible problems that caused the error Thanks a lot.
  • wdc1

    thanks. i found this program which was originally in C# and i converted it into vb.
    when i activesync the client program into the pocket pc. i typed the loop back ip 127.0.0.1 in the "txtIPAddr" textbox, it came out this error: 

    "No connection could be made because the target machine
    actively refused it."

    then i typed my computer ip 172.17.168.81 in the  in the "txtIPAddr" textbox, which came out this error:

    "an exisiting connection was forcibly closed by the remote host."

    here is the client program coding for the connection part. did i used the wrong ip or the coding is totally wrong

    Private m_DataBuffer As Byte() = New Byte(10) {}

    Private m_asynResult As IAsyncResult

    Public pfnCallBack As AsyncCallback

    Public m_socClient As Socket

    Public theSocPkt As CSocketPacket = New CSocketPacket

    Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click

    Try

    m_socClient = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

    Dim ip As IPAddress = IPAddress.Parse(txtIPAddr.Text)

    Dim iPortNo As Integer = System.Convert.ToInt16(txtPort.Text)

    Dim ipEnd As IPEndPoint = New IPEndPoint(ip.Address, iPortNo)

    m_socClient.Connect(ipEnd)

    EnableCommands(False)

    WaitForData()

    Catch se As SocketException

    MessageBox.Show(se.Message)

    EnableCommands(True)

    End Try

    End Sub

    End Class

    Public Class CSocketPacket

                Public thisSocket As System.Net.Sockets.Socket

                Public dataBuffer As Byte() = New Byte(1) {}

    End Class


  • GShaw

    This forum is for asking questions related to .NET network programming APIs.
    Unfortunately we can't provide tutorials and debugging support through this forum.
    MSDN is the place for tutorials and documentation. Product support provides support services.

    If you have a specific question we will be glad to help. Please consult the Socket API documentation and related books before you post questions.
    Thanks and good luck.

  • CVL

    Once again there is no built in Winsock Component or COntrol so to speak.
    However there is a complete Winsock API that you could use. This is not a
    Windows FORMS control but we have .NET APIs under system.net namespace.
    One could easily create a winsock cotrol based on this api though


  • Rathish P S

    That said, if you would like to see a control like the VB6 Winsock control added to the framework, please feel free to request such a feature by emailing nclasks@microsoft.com.dontspam (remove the .dontspam).  

    Thank you for your feedback.



  • Marm

    There is no managed Winsock Component you can drag and drop.
    However you have Socket APIS in the System.Net.Sockets.
    You can look at the help in http://msdn.microsoft.com/net

  • USing Winsock in .net framework