Solved

Winsock Control

Posted on 1997-05-01
2
294 Views
Last Modified: 2013-11-13
Hi,

I'm using Visual Basic 5 to create a simple TCP/IP client.  I have add a Winsock control to the main form of the application and can make a telnet connect to a remote host.

What i'm trying to achieve is when a menu option is selected a a sting of characters will be transmitted to the host and a response waited for.  Depending on the menu option different characters are transmitted. The response will be output in a dialog box.

i have tried the following (Query is the menu option)

Private Sub Query_Click()
dim received as String

Winsock1.SendData ">>P001"
received = ""
while received = ""
     Winsock1.PeekData received
wend
` we have some data
` so lets display it
End Sub

What seems to happen is that Winsock1.SendData completes OK. But data is not transmitted to the remote host. As the remote host does not send anything back till it receives an input. we get into a loop.  I have noticed that Winsock1.SendData only physically transmits the data when Query_Click() functions exits.  If  this is how it works how can I have a function which is called by a click of a menu option which sends data waits for a response displays the result then sends some more etc etc.

Robert
0
Comment
Question by:Robert888
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Expert Comment

by:bitz
ID: 1425902
I need to know one thing.  What Winsock Control are you using?  (Did you download the Internet Control Pack from MicroSoft?).  If  you say the filename, I'll know what one your using.  Thanks,
                        -bitz(program@mindless.com)
0
 

Accepted Solution

by:
lmeijer earned 50 total points
ID: 1425903
Robert,

Place a doevents statement! Otherwise you don't let events
happen to fill the data.

while received = "" 
  Winsock1.PeekData received
  DoEvents
wend
 
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 - Convert HH:MM into Decimal 8 76
Spell Check in VB6 13 148
Set WorkSheet  not Working 9 62
VB script to continue despite error 2 78
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question