Click here to Skip to main content
15,913,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while I am sending SMS it give me Error Like "The Operation has time out " and I trace that error is in this line - "objStream = sResponse.GetResponse.GetResponseStream()"
Following is my Code


Dim sURL As String
Dim objReader As StreamReader
Dim objStream As Stream
Dim sResponse As WebRequest


sURL = " MyAPI"
sResponse = WebRequest.Create(sURL)

objStream = sResponse.GetResponse.GetResponseStream()



Can Any one help what is wrong I don't understand because first time it not give me that error while I am sending second time it give me that error


Help Me Please...
Thank You
Posted

1 solution

The problem can be caused by congestion on the network, either yours or at the destination.

See if the API you are using has a TimeOut property that you can set. Most TimeOut properties will work in milliseconds. Start at a low number like TimeOut = 3000 which will give you a 3 sec TimeOut trigger. Gradually increase the TimeOut until you get your application to run stable. Do not try to over do the TimeOut setting as it will have performance issues in your application unless you are using Threading to have the process run in the background.

You can also try to reinitialize your variables using "New". Not sure if that will help much because the reason for your timeouts are unknown at this time.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900