Results 1 to 12 of 12

Thread: [resolved, kind of] VB stop responding when winsock tries to connect

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Red face [resolved, kind of] VB stop responding when winsock tries to connect

    Here is how it goes: I've got a simple chat app that uses MS Winsock control for TCP communication. The first time I run the app from VB its all OK. But, when I exit the app (normally, not break), return to VB, run it again, it crashes (app & VB stop responding and need to be killed) when Connect button is clicked. When runing it as an exe when its built everything is OK.

    Any ideas why this is happening?
    Last edited by ns-code; Jun 11th, 2005 at 06:07 AM.
    ( : ns-code : )
    FCP Products

  2. #2
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: VB stop responding when winsock tries to connect.

    Quote Originally Posted by ns-code
    Here is how it goes: I've got a simple chat app that uses MS Winsock control for TCP communication. The first time I run the app from VB its all OK. But, when I exit the app (normally, not break), return to VB, run it again, it crashes (app & VB stop responding and need to be killed) when Connect button is clicked. When runing it as an exe when its built everything is OK.

    Any ideas why this is happening?
    Are you running some checking routine in a loop without any DoEvents statement. That might be the culprit. Run the code line by line (F8) and see where it starts causing problems.

    Pradeep
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect.

    It fails on Winsock.Connect. It also fails on server side (different program), so my code is definitly not the problem.

    Btw, it's VB6 with SP5, Win XP SP1. I've got another dual boot Windows XP SP1, and it also fails there.
    ( : ns-code : )
    FCP Products

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: VB stop responding when winsock tries to connect

    Hey Ns-Code,

    so my code is definitly not the problem
    The Number of times I have said this

    Ok i've moved you post to the network forum, Now then could you post you application for me to have a look at? I should be able to find the problem.

    Pino

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect

    Ok, i've put it in a general forum thinking that it's actually a VB problem.. Anyway, here are the source files. User interface and most comments and object names are in Serbian, but I hope you'll find your way around

    ( : ns-code : )
    FCP Products

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect

    One other thing. I just downloaded your winsock chat example, just to see... and gues what - it crashes too! So, it's DEFINITLY not MY code problem

    Oh, and if you see any stupidity in my code, please excuse it... this is a come back projet for me, haven't done anything in VB for over a year and it was done in three days
    ( : ns-code : )
    FCP Products

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: VB stop responding when winsock tries to connect

    Does VB have access thru the firewall?

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect

    Sygate was running, but in Allow all mode. I tried restarting without it to no avail.
    ( : ns-code : )
    FCP Products

  9. #9
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: VB stop responding when winsock tries to connect

    It doesnt crash here,

    Tell me exactly how to make it crash?

    Firewall shouldnt be an issue,

    Set Ip To 127.0.0.1

    Let Me Know

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect

    Run it. Click connect. Regardles if it succesfully connects to the server or not, stop it to return to VB. F5 it again and click connect.
    ( : ns-code : )
    FCP Products

  11. #11
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Re: VB stop responding when winsock tries to connect

    No problems here at all,

    2.6ghz P4 with 512 Ram,

    Try adding some doevent sinto you connection request loop.

    VB Code:
    1. For i = 1 To Winsock.Count + 1
    2.         Fnd = False
    3.         For x = 1 To lsvUsers.ListItems.Count
    4.             If lsvUsers.ListItems(x).Text = i Then Fnd = True
    5.         Next x
    6.         If Not Fnd Then
    7.             Exit For
    8.         End If
    9.     Next i

    But theres no problems here it connects 1st second and third time

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Novi Sad, Serbia and Montenegro (formerly known as Yugoslavia)
    Posts
    148

    Re: VB stop responding when winsock tries to connect

    Ok, thanks for the help. It's not that big of a problem anyway as it appears only during development.. just anoying and the project is nearly finished anyway
    ( : ns-code : )
    FCP Products

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