socket help:simple example PLEASE!
i have seen sockets before and everytime i see all those functions i look back the other way
now i am really reading up on them and getting it but i just need 1 example
please
all i need is 1 clear cut example on how to download the file "http://www.google.com/intl/en/images/logo.gif" using net.sockets.socket
no need for ' remarks or even unnecessary callbacks
i just want this simple example
please help!
Re: socket help:simple example PLEASE!
Quote:
Originally Posted by imadthemad
i have seen sockets before and everytime i see all those functions i look back the other way
now i am really reading up on them and getting it but i just need 1 example
please
all i need is 1 clear cut example on how to download the file "http://www.google.com/intl/en/images/logo.gif" using net.sockets.socket
no need for ' remarks or even unnecessary callbacks
i just want this simple example
please help!
Hi,
I found a very good site where you can find not only the explanation but also some examples. Try them:
http://search.microsoft.com/search/r...&c=4&s=1&swc=4
and
http://msdn.microsoft.com/library/de...classtopic.asp
Hope it helps,
sparrow1
Re: socket help:simple example PLEASE!
hmm
why didnt i come across that in my local msdn?
thanx i think it will do but it would still be easier if some1 just posted the clear cut example on how to download a file
Re: socket help:simple example PLEASE!
Hi again,
I found in the same MSDN site a download Method;
http://msdn.microsoft.com/library/de...SV01034331.asp
May I give you also an advise, there are a lot of very good developers who wants to help people with programming problems on this forum! But the only thing they want is that you try at least something and let them see your example code. Otherwise you never going to learn it, because for them it's easy and for you it's just copy and paste!
I'm still learning but not with the copy and paste method!
So try something and show us!
Wkr,
sparrow1
sparrow1
Re: socket help:simple example PLEASE!
hey man i tried something but i am having trouble it is not doing anything after the socket.recieve line
here is the code:
Private Sub download()
Dim ip As New Net.IPEndPoint(Net.Dns.Resolve("www.google.com").AddressList(0), 80)
Dim ascii As New ASCIIEncoding
Dim ane As Net.EndPoint
Socket.Connect(ip)
Dim request As String = "GET / HTTP/1.1" + ControlChars.Cr + ControlChars.Lf + "Host: " + "www.google.com" + ControlChars.Cr + ControlChars.Lf + "Connection: Close" + ControlChars.Cr + ControlChars.Lf + ControlChars.Cr + ControlChars.Lf
Dim bytesSent As [Byte]() = ascii.GetBytes(request)
Dim bytesReceived(255) As [Byte]
Dim bytes As Int32
Dim page As [String] = "Default HTML page on www.google.com" + ":" + ControlChars.Cr + ControlChars.Lf
Do
bytes = Socket.Receive(bytesReceived, bytesReceived.Length, 0)
page = page + ascii.GetString(bytesReceived, 0, bytes)
Loop While bytes > 0
MsgBox(page)
End Sub