Results 1 to 5 of 5

Thread: Winsock stops receiving data

  1. #1

    Thread Starter
    Hyperactive Member Teseng's Avatar
    Join Date
    Sep 2007
    Location
    Tupelo, MS
    Posts
    281

    Winsock stops receiving data

    I'm using VB6 for first, with a server/client winsock.
    On load, my client connects to the server, and on connection, it loads a login prompt. The winsock only works one time, which is fine as long as the login information is correct. If they get it wrong, the server sends the data that tells the client that its wrong, which simply pops up a message box. For some reason, when it sends that data, the winsock stops receiving data on that Login form, and queues the data up in the background, so as soon as the login form unloads, the the messages flood in. I cant seem to find any errors in the sending/receiving in the code. I was curious if since its a vbModal form, it would cause the winsock on the main form(the one behind it) to stop processing data?

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Winsock stops receiving data

    Could you please post your code so we can see exactly what's it doing.

  3. #3
    Addicted Member ThorSubak's Avatar
    Join Date
    Apr 2008
    Location
    Cebu
    Posts
    153

    Re: Winsock stops receiving data

    did you often make the server winsock control to be array?
    if so, just post the code for some clarification.

  4. #4

    Thread Starter
    Hyperactive Member Teseng's Avatar
    Join Date
    Sep 2007
    Location
    Tupelo, MS
    Posts
    281

    Re: Winsock stops receiving data

    Its actually extremely simple code it honestly wouldn't really help to post it.
    the winsock gets the data, passes it to a function, and is SUPPOSE to display a message box.

    The complete process is: On load, the CLient connects, and loads a login prompt via "FrmLogin.Show vbmodal, Me" -me- being the main form (frmMain)

    The login prompt sends data to the server, and the server sends the response back, either successful login or failed. It works perfect, once.

    For example, if you login, and typo your password, it pops up the msgbox and says incorrect password, at that time, the winsock stops receving data, the login function still sends fine. As soon as frmLogin is hidden, the received data is instantly rushed out, and piles up messageboxes etc.

    EDIT: It seems if i show the forms non-modal then it works fine, the only problem with that is, that i need them modal otherwise it sorta makes things a tad messy
    Last edited by Teseng; Apr 12th, 2008 at 03:58 AM.

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Winsock stops receiving data

    One way around this is to make your "login form" a UserControl instead.

    Put it on the main Form, sized small in some corner, and initially set Visible = False. Call into a method ("ShowDialog" etc.) that makes itself Visible after centering itself on its Parent and resizing itself to the normal dialog size and setting its ZOrder to top. When you want to "hide" it have it make itself non-Visible again.

    The main reason for placing it sized small is to keep it out of the way of other controls when designing the rest of the main Form.

    This could also be done with a Frame that is normally non-Visible at runtime, but it is clumsier to deal with during design.

    In either case having the "dialog" expand to cover the entire main Form will prevent users from fiddling with other controls if desired. You could also set Enabled = False on them all.

    All of the events (such as the Winsock events) will run and everyone will be happy!

    Just a thought.

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