You cannot use a VB timer it won't refire until the event as ended. I recommend you try an API timer.
Main Topics
Browse All TopicsI have a tcpip client and tcpip server program. After transfering 1 file to the server, server program will acknowledge with a reply. Somehow, after transfering some files, the server is unable to send a reply back to the client. Therefore, I would like to set a timeout at my client program such that say after waiting for 1 min, it will disconnect if there is no reply from the server. Where can I set the timeout? Also, does anybody know why the server will stop responding aftering receiving a few files? Is it because of not enough memory?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
As for why my server stop responding, I actually found something on the which I don't have in my code. Could this be the reason? Because after adding this in, it works fine.
--> unload tcpServer(index)
As for the timeout, I will try both ways.
BTW can I do it such that it will start timing if the transfer bytes are not moving?
I'm not sure what TheBlazer is referring to "it won't refire". If you set a timer with a specified interval, it should fire on that interval. The VB6 timer is just a wrapper for the API Timer. The benefit of using an API Timer is that you don't have to have a control on a form.
If an event is firing when bytes are received, you could put the code for the timer within this event. Set the timer after each event and if it fires before you receive anymore bytes, this could indicate that you're hanging.
Latz
jp
I enabled the timer in the SendProgress events. And the timer interval is 30 sec = 30000. What i do below is only to enable and disable the timer based on the condition.
Private Sub tcpWS_SendProgress(ByVal bytesSent As Long, ByVal bytesRemaining As Long)
if transferring_now Then
status1.Caption = "Bytes Sent " & (local_file_size - bytesRemaining) & " ..."
If bytesTransfer = (local_file_size - bytesRemaining) Then
ftTimeout.Enabled = True
LogStatus "SendProgress_Timeout set"
Else
ftTimeout.Enabled = False
LogStatus "SendProgress_Timeout Reset"
End If
bytesTransfer = local_file_size - bytesRemaining
End If
End Sub
Business Accounts
Answer for Membership
by: jackblackPosted on 2002-10-25 at 00:46:26ID: 7368387
Well, for the time-out, you could use a timer. Set it to fire in one minute just before you send your file and if you receive your response, set the timerinterval to zero.
You could also use a system timer vs the timer object. Check the msdn information on timers. http://msdn.microsoft.com and do a search on "timer". Or use the viewapi application that comes with VB6 (I hope you're using VB6).
Another possible way to would be to set a time-out on the connection itself, but with-out specific details on how your connecting and the communication process....
As far as why your server stops responding, it would be necessary to review your code to determine. Do you keep the connection open between the client and the server? You might try connecting just before the transfer and terminating the connection after. This would probably be better for your server and network anyway.
Latz
jp