Results 1 to 5 of 5

Thread: socket help:simple example PLEASE!

  1. #1

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    Question 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!

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    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
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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

  4. #4
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    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
    Last edited by sparrow1; Dec 5th, 2005 at 11:43 AM.
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  5. #5

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width