Results 1 to 23 of 23

Thread: Unable to make a online chat.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Unable to make a online chat.

    Hi, i've followed Vb6.us tutorial for how to make a simple chat.
    Now i've opened port 1336-1336, and checked my IP from Myip.se.

    If i connect to my chat with local settings, 127.0.0.1 as IP, it connects.
    If i connect to my chat with online settings, xxx.xxx.x. And port 1337, it wont connect.

    Any suggestions ?

  2. #2
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Unable to make a online chat.

    Don't if my problem relates to yours. I was trying to open a local file on my pc from my website, but could not, because i have 2 ip settings one on my pc and one after my router. I was trying to setup my own live chat.
    I finally just used a free one: http://www.livezilla.net/downloads/
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  3. #3
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    Hi, i've followed Vb6.us tutorial for how to make a simple chat.
    Now i've opened port 1336-1336, and checked my IP from Myip.se.

    If i connect to my chat with local settings, 127.0.0.1 as IP, it connects.
    If i connect to my chat with online settings, xxx.xxx.x. And port 1337, it wont connect.

    Any suggestions ?
    You would get better help if you just simply posted the code you are using.

  4. #4
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Unable to make a online chat.

    I made a chat app awhile ago fortunately some of my post about it remain. You might find them useful!

    http://www.vbforums.com/showthread.php?t=234908

    Edit:

    Here is a basic example I did years ago:
    http://www.vbforums.com/showthread.php?t=236973

    If you want to enable ftp for your program:
    http://www.vbforums.com/showthread.php?t=237913
    Last edited by Nightwalker83; Dec 25th, 2008 at 08:52 PM.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  5. #5
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: Unable to make a online chat.

    Are you testing on computers connected via Internet?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    jmsrickland, The code is very very VERY simple.

    Client:
    vb Code:
    1. Private Sub CmdConnect_Click()
    2. sockmain.RemoteHost = txthost.Text
    3. sockmain.RemotePort = txtport.Text
    4. sockmain.Connect
    5. End Sub
    6. Private Sub CmdSend_Click()
    7. sockmain.SendData txtsend.Text
    8. End Sub
    9. Private Sub Form_Load()
    10. Form2.Show
    11. End Sub
    12. Private Sub sockmain_DataArrival(ByVal bytesTotal As Long)
    13. Dim strdata As String
    14. sockmain.GetData strdata, vbString
    15. txtstatus.Text = txtstatus.Text & _
    16. strdata & vbCrLf
    17. End Sub


    --
    Server:

    vb Code:
    1. Private Sub CmdListen_Click()
    2. sockmain.LocalPort = txtport.Text
    3. sockmain.Listen
    4. End Sub
    5. Private Sub CmdSend_Click()
    6. sockmain.SendData txtsend.Text
    7. End Sub
    8. Private Sub Form_Load()
    9. End Sub
    10. Private Sub sockmain_ConnectionRequest(ByVal requestID As Long)
    11. If sockmain.State <> sckClosed Then
    12. sockmain.Close
    13. End If
    14. sockmain.Accept requestID
    15. txtstatus.Text = txtstatus.Text & _
    16. "Accepted connection from: " & _
    17. sockmain.RemoteHostIP & vbCrLf
    18. End Sub
    19. Private Sub sockmain_DataArrival(ByVal bytesTotal As Long)
    20. Dim strdata As String
    21. sockmain.GetData strdata, vbString
    22. txtstatus.Text = txtstatus.Text & _
    23. strdata & vbCrLf
    24. End Sub

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    Nightwalker, thanks for the codes. but it's not the coding that's wrong i guess, it's the ports or something. They ARE open and enabled.
    It might be that, when i installed VB6 it found the Winsock corrupt and i needed to fix that by downloading microsoft fix something, which made it work.

    dee-u, I just simply starts from my computer and type the things in, everything is in the same computer.
    Connected via internet, yes... if i understand that right.

  8. #8
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    Nightwalker, thanks for the codes. but it's not the coding that's wrong i guess, it's the ports or something. They ARE open and enabled.
    It might be that, when i installed VB6 it found the Winsock corrupt and i needed to fix that by downloading microsoft fix something, which made it work.
    In your original post you said that you enabled ports 1336 - 1336.

    Now i've opened port 1336-1336, and checked my IP from Myip.se.
    I'm guessing that is a typo and you mean to type 1336 - 1337 but port 1337 is the port your are listening on?
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    Incorrect, my router says port 0 - 0, so i put 1337 - 1337. just for opening case. and i've tried "Both UDP and TCP" still nothing..
    Correct, im listening on port 1337

  10. #10
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    Hi, i've followed Vb6.us tutorial for how to make a simple chat.
    Now i've opened port 1336-1336, and checked my IP from Myip.se.

    If i connect to my chat with local settings, 127.0.0.1 as IP, it connects.
    If i connect to my chat with online settings, xxx.xxx.x. And port 1337, it wont connect.

    Any suggestions ?
    When you get your IP from Myip.se (I'm guessing that's an online website that tells you what your IP is) you are getting your external IP; the IP that is accessable from the outside world (as long as you allow the outside world to connect to you) and that is not your internal IP which is the IP you need to use if you are running both Client and Server on the same PC.

    So, when you run your Client/Server chat on the same PC and you use 127.0.0.1 and the client uses the same Port Number that the server is on then it works.

    When you connect to your server using xxx.xxx.x (I'm guessing this is the IP you got from Myip.se) from your client on the same PC it wont work because that IP is not your internal IP.

    For testing purposes use your internal IP or the loop-back IP of 127.0.0.1. When you are ready to use your chat accross two different PCs (yours and your friend's PC) then you use your external IP.
    Last edited by jmsrickland; Dec 26th, 2008 at 12:07 AM.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    Jmsrickland, my friend who tried my first applications were able to connect as the same way im trying, and he did exact same way.
    I've send my newest application to him, and it doesn't work.

    So im asking again, is it possible that my Wnsck.ocx is corrupt, because it was from installation, but later on were fixed.

  12. #12
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Yes, it is possible.

    Put a _Error event in your code and see if anything happend there.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    I've done that, and i get socket timed out

  14. #14
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    Jmsrickland, my friend who tried my first applications were able to connect as the same way im trying, and he did exact same way.
    I've send my newest application to him, and it doesn't work.

    So im asking again, is it possible that my Wnsck.ocx is corrupt, because it was from installation, but later on were fixed.
    I have attached my mswinsck.ocx, if you want to try another one
    Attached Files Attached Files
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  15. #15
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    I've done that, and i get socket timed out
    Well, I really doubt that you have a corrupted Winsock control. You are doing something that you are not telling us exactly what it is.

    You say that you and your friend were successful before but now on you newer version he cannot connect to you. Have you tried the other way around; you connect to him (he is the server, you are the client). Make sure the server is up and listening before you try to connect. BTW: how does your friend know when to connect? Are you communicating over the phone and you tell him that your server is up and listening and what your IP is and the Port number? Could it be a firewall problem (his side or your side)?

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    Jmsrickland, I will tell you exact.
    I've Vb6 at my fathers house, works perfect.
    Now I'm at my moms house, newly installed but got an error when i were about to insert a WnSck.ocx to my program, but microsoft had a program which fixed that problem.
    now, Me and my friend we're on ventrilo, he was the server because i don't have access to router settings at my fathers house.
    Now, He didn't have to open firewall and stuff, only ports. which i had too.
    Just sounds so strange, that it won't work :s

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    91

    Re: Unable to make a online chat.

    isnoend07, i tried your idea too, no progress :/

  18. #18
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    OK, I am going to take your word for it that

    1) The Server is up and running and waiting in the Listening Mode
    2) The Client's RemoteHost IP is exactly the external IP address of the Server
    3) The Client's RemotePort is exactly the same as the Server's Port number
    4) Then the Client tries to connect to the Server and all that happens is you get a timeout error.

    Did you even try isnoend07's example to see if that works? However, if he didn't include his Winsock.ocx then even that probably won't work.

    Rather than try and to fix that Winsock error with Microsoft whatever why don't you just go get another Winsock.ocx from the Intenet and use it.

  19. #19
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    Jmsrickland, I will tell you exact.
    I've Vb6 at my fathers house, works perfect.
    I noticed in your code you have sockmain listening after you click the command button. I suggest putting it in the form load event:

    Code:
     Private Sub Form_Load()
          sockmain.LocalPort = 1337
          sockmain.Listen
          End Sub
    Also your code to close the connection is formatted incorrectly.

    Try:

    Code:
      Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
          If  sockmain.State <> closed Then  sockmain.Close
           sockmain.Accept requestID
          End Sub
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  20. #20
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Actually, you don't even need to test for the Winsock state in the _ConnectionRequest Event
    Code:
    Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
     sockmain.Close
     sockmain.Accept requestID
    End Sub
    is all that is needed

  21. #21
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Unable to make a online chat.

    Quote Originally Posted by Nightwalker83
    I noticed in your code you have sockmain listening after you click the command button. I suggest putting it in the form load event:

    Code:
     Private Sub Form_Load()
          sockmain.LocalPort = 1337
          sockmain.Listen
          End Sub
    Also your code to close the connection is formatted incorrectly.

    Try:

    Code:
      Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
          If  sockmain.State <> closed Then  sockmain.Close
           sockmain.Accept requestID
          End Sub
    No, you are incorrect here, Nightwalker

  22. #22
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Unable to make a online chat.

    Quote Originally Posted by jmsrickland
    No, you are incorrect here, Nightwalker
    Yeah, I saw your code without:

    Code:
     If  sockmain.State <> closed Then  sockmain.Close
    Your way is quicker! I must admit I am not a computer programmer and it has been years since I last created a program in Visual Basic.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  23. #23
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: Unable to make a online chat.

    Quote Originally Posted by macbrutal
    dee-u, I just simply starts from my computer and type the things in, everything is in the same computer.
    Connected via internet, yes... if i understand that right.
    I would suggest that you need to test it in an environment where the computers are connected via internet and not just one computer.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

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