3 Replies - 2170 Views - Last Post: 06 August 2009 - 08:46 PM Rate Topic: -----

#1 wylieE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 08-April 09

Problem with Winsock control

Posted 06 August 2009 - 06:56 PM

Attached File  both.zip (30.44K)
Number of downloads: 57Basicly ive been working on this for awhile, I got some sample code for a file transfer it was wrote in vb06 and im trying to convert it to vb.net. well it converts fine but i just cant figure this out. Ive added the file attachment.

Private Sub tcpServer_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles tcpServer.DataArrival
		'
				Dim Command_Renamed As String
		Dim NewArrival As String
		Dim Data As String
		Static DataCnt As Integer
		
		tcpServer.GetData(NewArrival, VariantType.String)   '← problem right here

		
		' Extract the command from the Left
		' of the comma (default divider)
		Command_Renamed = EvalData(NewArrival, 1) 		' extract the data being sent from the
		' right of the comma (default divider)
		Data = EvalData(NewArrival, 2)
		
		' execute according to command sent
		Dim Fname As String
		Select Case Command_Renamed
			
			Case "OpenFile" ' open the file
				
				' the file name only should've been sent
				Fname = My.Application.Info.DirectoryPath & "\" & Data
				FileOpen(1, Fname, OpenMode.Binary)
				' file now opened to recieve input
				Status("File opened.... " & Data)
				
			Case "CloseFile" ' close the file
				' all data has been sent, close the file
				FileClose(1)
				Status("File Transfer complete...")
				Pause(3000)
				Status("Listening... (Connected)")
				
				' when sending a file.... it is best not to Name
				' the Case instead use ELse for file transfer
				
			Case Else ' a 4169 byte string of incoming data
				' write the incoming chunk of data to the
				' opened file
								FilePut(1, NewArrival)
				' update the view port with the new addition
				' ** // ** '
				' IMPORTANT: comment out the code below when sending files
				' larger than 500Kb. It makes the function CRAWL otherwise
				
				txtView.Text = txtView.Text & NewArrival
				' comment the above line to increase speed
				
				' count and report the incoming chunks
				DataCnt = DataCnt + 1
				Status("Recieving Data... " & (MAX_CHUNK * DataCnt) & " bytes")
				
		End Select
		
	End Sub


EDIT: Title edited to be more descriptive

PsychoCoder :)

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with Winsock control

#2 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Problem with Winsock control

Posted 06 August 2009 - 07:14 PM

Are you receiving any errors? Does this code not work that way you intended it? When asking for help there are a couple items that are vital in order for someone to properly help you:
  • Post the code you're having problems with
  • Post the exact error you're receiving, if you are receiving one
  • If no error explain what the code is doing versus what you want it to do
  • Post your question in the body of your post, not the description field

Was This Post Helpful? 0
  • +
  • -

#3 wylieE  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 08-April 09

Re: Problem with Winsock control

Posted 06 August 2009 - 07:51 PM

yeah the problem is that im getting a error at the line that i pointed to,it says, "Overload resolution failed because no accessible 'GetData' accepts this number of arguments". Im not familar with this Varianttype.String part. any suggestions?
Was This Post Helpful? 0
  • +
  • -

#4 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: Problem with Winsock control

Posted 06 August 2009 - 08:46 PM

The error is quite informative.
"Overload resolution failed because no accessible 'GetData' accepts this number of arguments"

Here are the ways that .GetData can be called.

.GetData(ByRef data As Object)
.GetData(ByRef data As Object, Byval type As Object, ByVal maxLen As Object)

And the way you are trying to use it.
tcpServer.GetData(NewArrival, VariantType.String)   '← problem right here


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1