Results 1 to 4 of 4
  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2010

    VB 2010 Winsock Client/Server

    Hello, all. This is my first post in here. I am currently learning how to program in VB and am using sample code to make a VB Winsock client and server. I beleive the sample code was from VB 6.0.

    I am getting an error with it though. Here is the code for the client:

    Imports MSWinsockLib
    Imports Microsoft.VisualBasic
    Imports System
    Imports System.Data
    Public Class Form1
        Private Sub cmdConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConnect.Click
            sockMain.RemoteHost = txtHost.Text
            sockMain.RemotePort = txtPort.Text
        End Sub
        Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
        End Sub
        Private Sub winsck_DataArrival(ByVal bytesTotal As Long)
            Dim strData As String
            sockMain.GetData(strData, vbString) ' <----ERROR HERE!!!!!!
            txtStatus.Text = txtStatus.Text & _
                strData & vbCrLf
        End Sub
    End Class

    Overload resolution failed because no accessible 'GetData' accepts this number of arguments.

    I am getting the exact same error in the exact same place in the server aswell. I have tried removing the vbString, but it comes up with a warning and the program doesn't function like it should.

    I am programming this in Visual Basic 2010 Express. Any help is appreciated! Thansk!


  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: VB 2010 Winsock Client/Server

    If you're using VB.NET then the first thing you should do is stop using VB6 controls. The .NET Framework has multiple classes in the System.Net.Sockets namespace that provide an implementation of Windows Sockets. If you're using .NET then you should use .NET. For an example of the .NET classes in action, follow the CodeBank link in my signature and check out my Asynchronous TCP thread.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    New Member
    Join Date
    Jul 2010

    Re: VB 2010 Winsock Client/Server

    you have too many arguments in the getdata variable, try les. or try to program arround it

  4. #4
    New Member
    Join Date
    Mar 2011

    Re: VB 2010 Winsock Client/Server

    I know this is an old thread but the way to get DataArrival is :

    Private Sub AxWinsock1_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival
                Dim strData As Object = vbNullString
                AxWinsock1.GetData(strData , vbString, e.bytesTotal)
                        txtStatus.Text = txtStatus.Text & _
                strData & vbCrLf
    End Sub

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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.