Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

WinSock in VB6 (SendData Problem)

Visual Basic 4 / 5 / 6

  • Please log in to reply
5 replies to this topic

#1 deepmadan

deepmadan

    CC Lurker

  • New Member
  • Pip
  • 7 posts

Posted 27 July 2011 - 01:15 AM

I am developing an application in VB6 which will communicate using UDP Connection to a hardware which recieves and sends data using UDP Connection. My Hardware works fine. It has already been tested with an application written in VisualC using UDP connection only. In VisualC, I had working on UDP Connection without Winsock.
Hardware's Remote IP and Port is been set to my computer's IP and Port 4040.


My code for connection and sending data is as below :


If Winsock1.State = sckClosed Then
   Winsock1.Protocol = sckUDPProtocol
   Winsock1.LocalPort = 4040    
   Winsock1.RemoteHost = "192.168.1.80"  'Hardware IP
   Winsock1.RemotePort = 4040               'Hardware's Port
   Winsock1.connect
   Winsock1.SendData "Hello"
Else
   Winsock1.Close
End If


I debugged this code and also the hardware and i found that
1. A Packet is sent to the hardware after WinSock1.connect command is executed.
2. But no Packet is been send after SendData Command as it requires Winsock1 in Connected State.


I want to know if i could senddata using winsock without my connection being accepted by the remote machine(hardware).
I am even able to recieve messages from Hardware on the DataArrival Function.

Edited by dargueta, 27 July 2011 - 09:37 PM.
Fixed formatting

  • 0

#2 wizarddrummer

wizarddrummer

    CC Newcomer

  • Member
  • PipPip
  • 13 posts

Posted 18 August 2011 - 12:10 PM

I had trouble with microsoft's WINSOCK. How are you declaring your variables?
I had that messed up one time and on another occassion it worked after i reinstalled WINSOCK.
Evediently something got confused. (What???? a microsoft application got confused and didn't work properly? Say it ain't true!)
  • 0

#3 deepmadan

deepmadan

    CC Lurker

  • New Member
  • Pip
  • 7 posts

Posted 18 August 2011 - 07:56 PM

The Problem is now solved.... I left winsock control as it was troubling me.. I had now used ws2_32.dll file to get all the connection functions......
  • 0

#4 wizarddrummer

wizarddrummer

    CC Newcomer

  • Member
  • PipPip
  • 13 posts

Posted 18 August 2011 - 08:02 PM

The Problem is now solved.... I left winsock control as it was troubling me.. I had now used ws2_32.dll file to get all the connection functions......


Great, I'm going to Google that .dll and see what it's about in case I have to do a project again that needs to communicate in the cloud.
  • 0

#5 deepmadan

deepmadan

    CC Lurker

  • New Member
  • Pip
  • 7 posts

Posted 18 August 2011 - 09:02 PM

In case you need any help in the dll ... you can reply here...
  • 0

#6 wizarddrummer

wizarddrummer

    CC Newcomer

  • Member
  • PipPip
  • 13 posts

Posted 18 August 2011 - 09:19 PM

appreciate it.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download