-
Jun 15th, 2010, 08:46 PM
#1
Thread Starter
New Member
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:
Code:
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
sockMain.Connect()
End Sub
Private Sub cmdSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSend.Click
sockMain.SendData(txtSend.Text)
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
Error:
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!
Cory
-
Jun 15th, 2010, 08:53 PM
#2
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.
-
Feb 24th, 2011, 05:17 AM
#3
New Member
Re: VB 2010 Winsock Client/Server
you have too many arguments in the getdata variable, try les. or try to program arround it
-
Mar 20th, 2011, 06:51 PM
#4
New Member
Re: VB 2010 Winsock Client/Server
I know this is an old thread but the way to get DataArrival is :
Code:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|