CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1

    Winsock... Argh!

    I am trying to experiment with winsock but am experiencing some difficulties. I have included the following code which seems to be the problem. After I run the program with the information inputted and click on this button below, Windows gives me a runtime error....
    address is not reachable from local machine

    what is the matter with my code?

    <vbcode>
    Private Sub Command3_Click()

    Text1.Text = "click"
    Text2.Text = Ip
    Text4.Text = Port
    Winsock1.RemoteHost = Ip
    Winsock1.RemotePort = Port
    Winsock1.Connect Ip, Port // error seem to be here

    End Sub
    </vbcode>


  2. #2
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Winsock... Argh!

    you cannot have varuable on the right side, it has to be on the left

    Text1.Text = "click"
    Ip = Text2.Text
    Port = Text4.Text
    Winsock1.RemoteHost = Ip
    Winsock1.RemotePort = Port
    Winsock1.Connect Ip, Port 'error seem to be here





    See how port = to text, not text = to port

    Good Luck!!!

    P.S. use ' to comment something (this is VB, not C++


  3. #3

    Re: Winsock... Argh!

    I dont know what I was doing. I must have been smoking crack. Thanks for your help though and making me realize that I am a moron.


  4. #4
    Join Date
    Aug 1999
    Location
    US, Florida
    Posts
    817

    Re: Winsock... Argh!

    LOL, no prob and have fun....


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

Featured