Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Make Winsock Wait


If I use


Code:
'Cient side
Sck.SendData "Test1"
Sck.SendData "Test2"

'Server Side
Private Sub Sck_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
Sck.GetData sData
End Sub
sData ends up being "Test1Test2"

Instead of two seperate DataArrival events, one yielding "Test1" and one yielding "Test2"


Is there a way to tell the winsock control not to do this, or do i have to somehow delimit this and process server side?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How Can I Make VBA Wait ?
I'm sending personalised e-mails from data in excel to inform people what I'll be direct debiting from their bank accounts. to do htis I'm using the Shellexecute command to open an e-mail link: (ie- mailto:robertphillips@s-h-g.co.uk?subject=subject&body=body), and then I use sendkeys to send Als-S to outlook. I then tell it to wait 2 seconds before restarting the for loop. This is all very well but I'd prefer not to use the "wait 2 seconds" bit and change it to something like "wait until excel get's focus back". My code is below. Can anyone help me?



sub send_emails
for r = 6 to Fillnum + 5 'data in all the rows
' .
'here is some code that writes the personalised messages
' .
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Txt & "&content-type=text/html"

' Execute the URL (start the default email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

' Wait two seconds before simulating Keystrokes Alt-S to send the message
Application.Wait (Now + TimeValue("0:00:02"))
SendKeys "%s"
next r
End Sub

Winsock Wait?
is there a way, when sending multiple messages through one winsock, to make sure winsock waits before sending a message?

say you're writing a program where there are two buttons

command 1 code is
winsock1.senddata "cmd:displaytime"

command 2 code is
winsock1.senddata "cmd:random"

is there a way to make sure it sends diplaytime then makes sure that is sent before sending random? so it doesnt come out

cmd:diplaytimecmd:random

on the other side?

Winsock Wait
Hello all,
I am using the Winsock control to monitor traffic on a TCP/IP connection. I
am gathering that traffic into an array built on every Winsock1_DataArrival
event. Does anyone know of a good way to start running code when there has
been no DataArrival event for a certain amount of time?

Thanks in advance!

How Do I Make INET1 Wait?
hi,
i was wondering if there is a way to do this :

i have a textbox wich will display a website's Source code, but i want it to show a new website once the initial one has loaded into the textbox,


so say i have 12 websites.
it should display website 1, once loaded, website 2, once loaded, website 3.etc..


How can i make the program pauze untill the website has loaded ( or even with a a maximum amount of time that it can take. before continueing..? )


Thank you!
Jeroen van Vierzen

Make Program Wait For Sub
Code:
Private Function Check()
'code
sockOCR.DownloadPicture PicURL 'once downloaded it calls PictureReady
'code
End Function

Private Sub sockOCR_PictureReady()
strCoordinates = sockOCR.OCR
End Sub

How would i make the program wait until it receives the strCoordinates and then continue on? Thanks for any help

How Do You Make A Timer Wait?
I have this code:

Code:
Private Sub tmrAB_Timer()
If IsTimeBetween(Val(txt1.Text), Val(txt2.Text)) Then
Procedure
End If
End Sub

Private Sub Procedure()
'code
'code
End Sub
I was wondering how i can make the timer wait after it has called the procedure sub until the procedure sub has completed.

Thanks for any help

How Can I Make A Wait Function?
I want an object to wait to move in 3 seconds after the program started and then 40 seconds later it would move again. Then 40 seconds after that. Then 40 seconds after that is all I need.

How To Make A Loop Wait
I am writting a program that opens up a website, and then is supposed to wait say...2 minutes for the user to look at the website, then to automatically go to a new website. Now I have a few questions...

To open IE i am using the command:

System.Diagnostics.Process.Start("http://www.yahoo.com")

Is there a better way to do that.

Also, what is the syntax to use to make the program wait...say... 120 seconds after going to that site before executing the next command.

Finally, I found that command via a google search. If i use the same command with a different address, will it open a new window or use the current one. I need it to keep the SAME window open and just change the URL. How would I go about doing that?

Any advice is appreciated.

Its kind of like an auto surfer that would give someone a tour of the basic sites on the net that everyone should know, like search engines, etc. Thats what Im going for. Any advice would be appreciated.


Thanks,
Weston

How Make The Script Wait
I need to know how to make a script WAIT till the previous process finishes

I am running shell"gpupdate /force" this will refresh the policies, but I want the script to wait till finishes refreshing then move ahead with the rest of the script.

Any help is appreciated

Thanks

Make Processing Wait
I am using a batch file to run some commands through third party software.
The batch file converts some files that I am trying to manipulate inthe next line of code. However, vb moves to process that next line before the batch file finishes running thus the files are not there yet.
I hope I'm making some sense...
I need vb pause processing until the batch finishes running.

my code.

Code:
Shell "c:mvcnvrtdb.bat", vbNormalFocus '<-- Batch file
FileCopy "c:mvvdetial1.dbf", "c:mvmvdatail1.dbf"
FileCopy "c:mvvheader1.dbf", "c:mvmvheader1.dbf"
FileCopy "c:mvdetial1.dbf", "c:mvrdatail1.dbf"
FileCopy "c:mvheader1.dbf", "c:mvrheader1.dbf"
FileCopy "c:mvidetial1.dbf", "c:mvmidatail1.dbf"
FileCopy "c:mviheader1.dbf", "c:mvmiheader1.dbf"
Kill "c:mvvdetail1.dbf"
Kill "c:mvvheader1.dbf"
Kill "c:mvdetail1.dbf"
Kill "c:mvheader1.dbf"
Kill "c:mvidetail1.dbf"
Kill "c:mviheader1.dbf"

Make Program Wait For Sub
VB Code:
Private Function Check()'code sockOCR.DownloadPicture PicURL 'once downloaded it calls PictureReady'codeEnd Function Private Sub sockOCR_PictureReady()   strCoordinates = sockOCR.OCREnd Sub


How would i make the program wait until it receives the strCoordinates and then continue on? Thanks for any help

How Do I Make The Program Wait?
How do I make my program wait a certain amount of time before going to the next command.

For example:

SetCursorPos 100, 100
wait 10 timer intervals
SetCursorPos 200, 200

Also, what is the code for simulating a left and right mouse click?

Make A Program Wait
Is ther any what to make a program wait for 30 sec. or until the user presses a button. For eximple i am making a chat where the computer says things to a sertain response. is there any way to do this without making a new case??

Make A Process Wait...
Hi,

Iam using an MS-Dos application in my VB. This application calls a decrypt.exe and decrypts the file to a .DOC file. The problem is b4 the MS-Dos process ends the Doc opens. But it opens the correct document. But the MS-DOS application crashes. IS there any way that I can make the application wait(for say 1 sec) and then open the doc, so that this doesn't happen.

Thanks,
Pres.

Wait For Winsock To Connect.
Hi all,

I wrote a GUI application which sends and recieves strings, parses them and then displays the information for monitoring purposes.
I have a function which needs to connect to a remote server using a winsock control and then send some data.
The issue is I need to make the function wait for the sock to connect before sending the data (of course) obviously this can be done by a loop of doevents until the sock is connected.
This solution is not good as it raises the CPU usage to 100% and I cannot afford that on that specific mahine.
I will be very greatful for any idea that can resolve this.
Thanks,

Boaz.

Winsock How To Wait All DataArrivals?
Hi again.
Is there a way to wait all incomming data before doing the action?
In my case the action is Bad, but this wont work.

Code:
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String, Bads As Integer
Winsock1.GetData strData, vbString
strData = Replace(strData, vbLf, "")
Bads = InStr(1, strData, "Wrong info.")

'Delay here? how.
If Bads = 0 Then 'we did get it again:
Call RunBack'Call to send another message
End If
End Sub

Thanks,
Naitsabes

Winsock Wait Question
Hi,

I have the following code:


VB Code:
Private Sub winsock_DataArrival(Index As Integer, ByVal bytesTotal As Long) Dim rdata As Stringwinsock(Index).GetData rdata fulldata = fulldata & rdata MsgBox fulldata


I know there's a thread a bit down below, but I'm using .GetData, not SendData.

The message box only shows a portion of the code. How would I get my message box to only pop up when winsock is completely done (all of the page is loaded into a single variable)?

Thanks.

Making Winsock Wait
I have a winsock control which is set to listen on form load. When it receives a connection it accepts, sends back some data then closes and begins listening again.
I have a feeling that its going right ahead and closing before its completed sending the data because my program on the other end never recieves it. Is there a way i can make the program wait until all the data is sent before continuing on?

Winsock : Need To Wait For Reply Then Do
I have a program that I want to send out like 5 things...

but when it sends out the first piece of text I want it to wait
for a response from the other end before it sends out the
next one... I guess I could make some timer function but
I wondered if winsock had some waitforreply method or something..


any ideas ??

Wait Until Winsock Is Connected
i am workin on a chat program and i need to make the program to wait until the winsock control is connected before it proceed with some other code. How can i do that?

thanx!

Is There A Way To Make A Program Wait Without A Timer?
I am adding a function to my scripting language so that the program will wait . . . Is there a function call or maybe some API to make a program stop execution for a certain amount of time?

How Can I Make VB Code To Wait For Another Process?
Please help!
I am using some programs written in C and compiled to exe files. I call them from VB code with the Shell function and give them the focus with AppActivate function. I would like to make my code to wait until the process started with shell is finished, and then execute the next line of code. How can I do this?

Thanks in advance,
Eva.

How To You Make The Script Wait/pause
I am trying to preform serveral action with this one script and most of the actions are launching executables. The problem I am running into is the script tries to preform the next step before it has finished installing the first action. How do I tell the script to pause or wait until the prior install is complete before proceeding?


thx

Make VB Wait For A Command To Finish
G'day,

I am trying to run Windows Defragmenter.


 Set WshShell = CreateObject("WScript.Shell")
 Dim RetVal As Long
 WshShell.Run "sndrec32 /embedding /play /close c:windowsmediaDefrag.wav", 1, True
RetVal = Shell("command.com /c defrag c:", vbHidden)
 WebBrowser1.Navigate "C:WindowsToolsdefreg2.gif"


It executes defragmenter fine. but continues on its merry way. How can I make VB wait??

Thanks,

MP

FTP And Inet, How To Make The Program Wait?
Hi,
I am trying to make a program that will download several files on several FTP servers every morning.
And I am using a Inet component. Everything works fine when I work in step by step, but when I just launch the program, the program is not waiting that previous request is done before working on next, so it results that nothing is working

Any idea on how I could fix this?
Thanks!

Here is the code:

Code:
Option Explicit
Dim status As String
Dim strData As String
Private Const ForReading = 1, ForWriting = 2, ForAppending = 8

Private Sub Form_Load()

Dim FTPAddress As String, FTPLogin As String, FTPPass As String, l_LineData As String
Dim l_Filename As String, l_DownloadedFilename As String, l_PathDownload As String
Dim l_SeverChange As Boolean, l_KeepWorking As Boolean
Dim fso As New FileSystemObject, fil As TextStream ' As Files

Set fil = fso.OpenTextFile(App.Path & "GetFiles.txt", ForReading)
If Err.Number <> 0 Then MsgBox "Opening GetFiles.txt failed. Reason: " & Err.Description

FTPAddress = Mid(fil.ReadLine, 7)
While Not fil.AtEndOfStream
FTPLogin = Mid(fil.ReadLine, 7)
FTPPass = Mid(fil.ReadLine, 7)
'Login on the FTP
Inet1.URL = FTPAddress
Inet1.UserName = FTPLogin
Inet1.Password = FTPPass
status = "DIR"
On Error Resume Next
Inet1.Execute , "DIR"
If Err.Number <> 0 Then 'Coun't connect? Pass to the next FTP SERVER
l_KeepWorking = False
ErrorList.AddItem "Connection to Server: " & FTPAddress & " FAILED, no file will be downloaded"
Else
l_KeepWorking = True
OkList.AddItem "Connected to Server: " & FTPAddress
End If

l_SeverChange = False

While Not fil.AtEndOfStream And Not l_SeverChange

l_LineData = fil.ReadLine
If Mid(l_LineData, 1, 6) = "ADDRS:" Then
l_SeverChange = True
FTPAddress = Mid(l_LineData, 7)
Else
If l_KeepWorking Then
l_Filename = Mid(l_LineData, 7)
l_DownloadedFilename = Mid(fil.ReadLine, 7)
l_PathDownload = Mid(fil.ReadLine, 7)
DownloadFile l_Filename, l_DownloadedFilename, l_PathDownload
End If
End If
Wend
On Error Resume Next
If Inet1.StillExecuting Then
timWorking.Enabled = True
'try to cancel the request
Inet1.Cancel 'It may take a while to cancel a request
End If
status = "CLOSE"
Inet1.Execute , "CLOSE"
Wend
End Sub

Private Function DownloadFile(p_Filename As String, p_NewFilename As String, p_path As String) As Boolean

Dim PlaceStr1 As Integer, PlaceStr2 As Integer
Dim DateToday As Date
On Error Resume Next
status = "GET"
'Insert the date in the downloaded file
PlaceStr1 = InStr(1, p_NewFilename, "*DATE")
PlaceStr2 = InStr(PlaceStr1 + 1, p_NewFilename, "*")
p_NewFilename = Mid(p_NewFilename, 1, PlaceStr1 - 1) & Format(CDate(Now), Mid(p_NewFilename, PlaceStr1 + 5, PlaceStr2 - PlaceStr1 - 5)) & Mid(p_NewFilename, PlaceStr2 + 1)
Inet1.Execute , "GET " & p_Filename & " " & p_path & p_NewFilename

If Err.Number <> 0 Then 'Coun't connect? Pass to the next FTP SERVER
ErrorList.AddItem "Download File: " & p_Filename & " FAILED. Error:" & Err.Description
Else
OkList.AddItem "Downloaded File: " & p_Filename
End If

End Function


Getfiles.txt looks like this :
ADDRS:ftp://address/
LOGIN:Login
PASSW:password
FILES:Downloadtext.txt
NewNF:Downloadtext*DATEMMDDYYYY*.txt
PATHF:C:/
FILES:Downloadtext2.txt
NewNF:Downloadtext2*DATEMMDDYYYY*.txt
PATHF:C:/

How Can I Make VBA Wait For Shellexecute To Finish?
I'm sending personalised e-mails from data in excel to inform people what I'll be direct debiting from their bank accounts. to do htis I'm using the Shellexecute command to open an e-mail link: (ie- mailto:robertphillips@s-h-g.co.uk?subject=subject&body=body), and then I use sendkeys to send Als-S to outlook. I then tell it to wait 2 seconds before restarting the for loop. This is all very well but I'd prefer not to use the "wait 2 seconds" bit and change it to something like "wait until excel get's focus back". My code is below. Can anyone help me?



sub send_emails
for r = 6 to Fillnum + 5 'data in all the rows
' .
'here is some code that writes the personalised messages
' .
' Create the URL
URL = "mailto:" & Email & "?subject=" & Subj & "&body=" & Txt & "&content-type=text/html"

' Execute the URL (start the default email client)
ShellExecute 0&, vbNullString, URL, vbNullString, vbNullString, vbNormalFocus

' Wait two seconds before simulating Keystrokes Alt-S to send the message
Application.Wait (Now + TimeValue("0:00:02"))
SendKeys "%s"
next r
End Sub

Wait For Winsock Connection To Be Complete
Hey all,

I have code that depends on the data gathered by the winsock connection. How do I stop this code from executing until the winsock connection is complete?

Several packets are received, so I can't put a flag to be changed upon receipt of data cause it'll change when the first packet is received.

Is there some sort of loop I can put in or something?


In addition, if I put any code whatsoever (like a message box) after the connection code, it moves on to the message box and then completely forgets about the connection.

How can I make it complete the connection first, then move on to the next line of code? This is very frustrating

Wait Till Winsock Is Ready
He everyone,

How can I make my program (a multi whois tool) wait before it's sending new information until the the winsock is ready with the other one...

Grtz,

Bloged

Make My Code Wait For Excel To Open
How can i make my code wait for excel to load so i can make my code input the data. At the moment my code is trying to input data while excel is loading so it cant.

How To Make Program Wait For Code To Execute?
I have a program with a timer that runs at a 1 second interval, every now and then this timer will open URLs with an Inet control which will take more than 1 second, how can I make sure all Inet calls are complete before the next timer event even though the URL calls take longer than the timer's set interval?

Will this automatically happen or do I need special code? I know I could execute the code in a modal window that would open each time which would do what I want, but I'd rather not have a window open each time that code must execute.

Thanks

How Do I Make A Process Wait Untill Something Is Loaded.
k I have 1 button and 2 text boxes.
When I click the button I want it to read from text box 1
and then use instr to get some information out of text box 1 and put it in textbox2.
The problem is I have to press the button twice because when I first click the button its empty. How would I add a Delay so I won't have to click it twice?

Make Programm Wait For PlaySound To Finish
I'm using the PlaySound API to play various sounds responding to a mouse click on a command button. This is the calling code I use:

strSound = Pfad_ & "FX_" & CStr(snd) & ".wav"
Screen.MousePointer = vbHourglass
gbResults = PlaySound(strSound, 0, SND_SYNC)
Screen.MousePointer = vbDefault

How can I make the program wait until this routine finishes playing the sound before allwing the user to press a mouse button or use the keyboard. Anybody tried this before?

Make A Batch File Not Wait For My App To Finish ?
Am on-site at the moment, and I have a slight problem.
When my app is loaded by the logon scripts on the computers here, it loads just fine, but then the logon script window will stay open until my app has finished running.

If I quit my app the logon script window immediately closes.

So how can I run my app from a logon script, and have the logon script not wait for it to end ?
I suppose I'm asking how I can make my app into a TSR...

How Do You Make Code Wait For An Amount Of Time?
How do you make code wait for an amount of time?

For example


Code:
? WASSUPPP
wait for 5 seconds
? Yo man waaasup

Make VB6 To Wait For Crystal Reports Display

VB6 and Crystal Reports 8.5

I am using the ActiveX control with standard print methods to display the crystal report.

i.e. XYZ.Action = 1  (to the Screen)

It works fine but I want the VB6 to wait until the users X’s out of the Screen Print display.  I then want to continue processing.

Question #1- How in the heck to I do that?

Question #2- Does anyone know if or what other Action =  codes are.  I have experimented with 2, 3, 4, 5 and the processing seems to be the same as 1.

Wait For Completion Of Dll Registry And Make Sure New Dll Is Registered
Hi!!!

I am working with a pda project, the application software for palm includes a conduit dll to be registered on to the pc
at the time of installation the setup package does that
but any time the pda is synced it looks for the dll update on website, if it finds one it downloads from website
then there is a call to another application to register this dll

the dll is being installed in right folder but it's getting registered
here is the code to update dll

Private Function UpdateDLL(File As String) As Boolean

        updatedll = true
        If UpdateDLL Then
            Shell "regsvr32 -s """ & App.Path & "" & File & """"""
         End If
    Else
        Text1 = Text1 & vbCrLf & "Web Conduit file could not be found."
    End If

        Exit Function
EH:
    MsgBox "ERROR - " & Err.Number & vbCrLf & vbCrLf & Err.Description, vbCritical
    UpdateDLL = False
End Function

once I exit this program and goto the conduit and click my application it says
memory cannot be read

when I went to the newly installed dll and checked the version it's the old one
I guess when I exit the program registering the dll, the program is not done registering dll

how do I check this

any help is appreciated

thanks
chandana

How Do I Make VB Wait For A Shell Command To Be Completed?
I have a vb program that issues a shell command to execute an MS-DOS program. The MS-DOS program may take several minutes to completely process the data. I want vb to wait until this program has completed execution before executing the next line of code. Is this possible?

How To Wait For A Specific Value In The DataArrival Evant In Winsock?
How can I wait until winsock gets a value, and check if it is a value I want?

How Can I Wait Until Winsock Is Connected And Data Is Received
Hi.
I am using a macro to download some data from web and then I have to parse it for needed parameters. The problem is that I know that to get the data I can do it only in
Winsock1_DataArrival
or Winsock1_Close

Is there any way to know that the data was received (Winsock1.getdata string) so that I can parse the string in the same function where I connect to the server in the first place?

Function
Winsock1.connect
PASS HTTP REQUEST VIA WINSOCK
----- I NEED TO KNOW HERE IF DATA WAS RECEIVED
parse string // OTHERWISE I AM PARSING EMPTY STRING

Winsock Wait For Text Output From Server
Hi Friends

i have a code which connects with one of my servers

I am sending a command to the server

The server replies with a "BEGIN" followed by messages then ends with an "END"

I want to wait until this is over and then send another command ..

Thia has to go on dynamically(ie the number of commands i need to send to the server is not static ..

friends how do i go about it

rgds
siva

Whats The Best Way To Make The Prog Wait Until Page Loads?
after I use wb.navigate2 "www.domain.com", whats the best way to make the program wait until the page is completely loaded before going to DocumentComplete to fire off an event? For some reason, my program is navigating to the site, but then going to DocumentComplete too fast and executing code and giving errors.

Make A Program Wait For A Locked File To Become Unlocked Before Accessing It
I have two identical programs running on two computers. Both of them access the same file on One computer.

If the first program that accesses the file puts a lock on it, what are my options for having the second program gracefully wait until the first program releases the lock.
I ask this because right now the second program crashes when encountering the lock and the error "access denied" appears to be untrappable (at least it is for me!)

Thanks

Wait Till A Previous DataTransfer Has Sent With Winsock Before Send... *slved*
hey ya,

Currently,

All i am sending to and from a system, is text.

But,

In it:

Its sending two commands:

cmdBuddyList : UserListHere
cmdComeOnline : User

: Recived like:

cmdBuddyList : UserListHerecmdComeOnline : User

Now, how can i make my server, wait before it sends the next lot of Data to my Client?

How To Make A Sub (function) Wait Until The Called Function Finishes
Hi.

I am a beginner to VBA and Basic thus my knowledge on how these SUBs (functions) are connected is very shallow. As I understand they are called as the process is going and they dont wait for each other in the run. Hence if u are running a sub within a sub like

Sub OKdokey ()
'' some code here
DoThisForMe
'' some code here
End Sub

Then even as DoThisForMe will start the OkDokey sub will continue to operate its code after DothisForMe.

Is there any way to make OkDokey wait until DoThisForMe is over cuz I have dependent values in an inside function and not waiting until the values are saved would mean my code to be incorrect.

Thanks for the help.
I would very much appreciate any help or internet links related to similar material.

-----------------------
AM

How Can I Make The Program Wait "X" Seconds...
Hello,
I want the program to load a file and about 3 seconds later perform some actions on it. I do not wanna use a TIMER. How can I make my program wait 3 seconds?

Thank you!

How To Make A Sub (function) Wait Until The Called Function Finishes
Hi.

I am a beginner to VBA and Basic thus my knowledge on how these SUBs (functions) are connected is very shallow.I am programming macro for the Outrlook 2002 on XP. As I understand they are called as the process is going and they dont wait for each other in the run. Hence if u are running a sub within a sub like

Sub OKdokey ()
'' some code here
DoThisForMe
'' some code here
End Sub

Then even as DoThisForMe will start the OkDokey sub will continue to operate its code after DothisForMe.

Is there any way to make OkDokey wait until DoThisForMe is over cuz I have dependent values in an inside function and not waiting until the values are saved would mean my code to be incorrect.

Thanks for the help.
I would very much appreciate any help or internet links related to similar material.

-----------------------
AM

Wait Cursor Icon For User To Wait
HI,

i am running a motor using my GUI. when user press "Run", motor will run. but, i want user to wait until motor finishes its run. so, i want "Wait Cursor(in c++) in my code. like that "time wait icon" until my run finishes.

how could i do that?

please help me
Thanks
Nilay

How To Make A Array Of Winsock?
Dim Network(1 To 50) As Winsock

Private Sub Command1_Click()
For player = 1 To 50
Network(player).RemoteHostIP = Trim("204.50.151.124")
Network(player).RemotePort = Trim(122)
Next player

End Sub

HOW DO I GET THIS TO WORK

Copyright 2005-08 www.BigResource.com, All rights reserved