Hello there, I have recently developed and finished a software in which works like aim. But here's the problem, the server worked just fine for local friends because they lived only 25 miles from the server, so it was lag-less. But when uploaded to a web host, it lags every time it pings the server. The server is in PHP, so there's no need to buy a dedicated computer for 400$/month more. Here's the function in which the client constantly calls upon:
Public Function GetPage(ByVal url As String)
Dim WReq As HttpWebRequest
Dim WResp As WebResponse
Dim sr As IO.StreamReader
Try
WReq = WebRequest.Create(url)
WReq.CookieContainer = cookies
WReq.Timeout = "120000"
WResp = WReq.GetResponse()
sr = New IO.StreamReader(WResp.GetResponseStream())
GetPage = sr.ReadToEnd()
WResp.Close()
Return (GetPage)
Catch err As SystemException
MsgBox("err message: " & err.ToString & vbCrLf)
Catch ex As Exception
MsgBox("err message: " & ex.ToString & vbCrLf)
End Try
End Function
A demo url would be something like http://localhost/chat/newpm.php?to=User&msg=Hello So how does OSCAR do it (the platform for AOL, aka AIM) and how does msg? gtalk or other big im clients do it?
I was thinking about recoding the getpage function so that it would connect to a TCP server and constantly wait for new messages which I am still not sure if this might cause a lag if the host is in the US and the client is not(for example). Could you please provide me a remedy to this problem?