PureHeart,
Do you have any specific needs reguarding sockets? I have written quite a few programs using the system.net functions and maybe I could give you a start. Do you need two programs to communicate or something different?
BTW does anone know if 2005 added a timeout to the HttpWebRequest initial request? I know there is a timeout that you can specify for already opened connections (httpRequest.Timeout) but not for the initial request. I look and pulled many a hair out till I found that it just simply could not be done in 2003. It always defaults to some predetermined value (21 seconds I believe).
While I am on the subject, here is some code that just about all beginners need when messing around with system.net. This code connects to a specified website and returns the HTML.
CODE
Try
httpRequest = CType(WebRequest.Create(“http://www.google.com”), _HttpWebRequest)
‘set theconnection timeout to 10 seconds
httpRequest.Timeout = 10000
‘change some of the headers so it makes the program look
‘like it cam from IE 6.0
httpRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, _image/pjpeg, application/x-shockwave-flash, application/vnd.ms _excel, application/vnd.ms-powerpoint, application/msword, */*"
httpRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows _NT 5.1; SV1; .NET CLR 1.1.4322)"
httpResponse = CType(httpRequest.GetResponse(), HttpWebResponse)
responseStream = httpResponse.GetResponseStream()
responseEncoding = System.Text.Encoding.GetEncoding("utf-8")
responseStreamReader = New StreamReader(responseStream, _responseEncoding)
‘This is the HTML string
‘Should put more error handling here, you will need it
dim strResponse as string = responseStreamReader.ReadToEnd
Catch ex As WebException
MessageBox.Show(ex.Status.ToString)
Catch ex As System.InvalidOperationException
MessageBox.Show(ex.Status.ToString)
End Try
Comment/Reply (w/o sign-up)