Results 1 to 15 of 15

Thread: [Solved with a happy ending] Winsock error

  1. #1

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Resolved [Solved with a happy ending] Winsock error

    I've got chat program and wanted to add file sharing across it. The thing is that i keep getting this winsock error:

    (40006) Wrong protocol or connection state for the requested transaction or request.

    I don't know what to do with it. I've tried everything I can . I don't know why it's happening! I've now tried adding msgbox to see what the status of the two winsocks that i have got for filesharing. Came up with both 7. I take it something went wrong with it.

    I have 2 forms, 3 winsocks (just to keep the connecting and the listening winsocks seperate for this). The ones with tcp are the filesharing winsocks. the wsChat winsock is for chatting (duh!).

    Can anyone help? The source is attached since I can't actually paste it onto here.
    Last edited by kregg; Mar 14th, 2006 at 06:39 AM.

  2. #2
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    there error means when your program tried to send some data, the sockets state is not connected.
    I've now tried adding msgbox to see what the status of the two winsocks that i have got for filesharing. Came up with both 7
    VB Code:
    1. MsgBox frmMain.tcpClient.State
    2.         MsgBox frmMain.tcpClient.State
    The above code is in your project, take a look at it.....its only checking the state of tcpClient. In your project the socket for sending files is tcpServer. When you try to send data it fires the error because tcpServer is not connected
    Chris

  3. #3

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    Thanks for pointing that out. I've been working on this for 2 days now so I think I've lost some brain cells if not any at all in the process. I'll get working on the tcpServer tommorow to see if I can get it to connect. Thanks for pointing out the tcpServer aswell the182guy.

  4. #4

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    This may sound like a stupid question, but how can I make the tcpServer connect properly? Doesn't seem to like working properly

  5. #5
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    tcpServer should be the one that accepts the connection, what do you mean by doesnt seem to be working, does it error?
    Chris

  6. #6

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    yeah i think so...

    let me try giving the code a go once more and i'll let you know how it goes.

  7. #7

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    I now found out the tcpClient has errors as before. I think I didn't do anything since I was completely clueless on how to solve it. You said before it's because it's tcpServer not connecting right. Would it help if I made the tcpConnect on a seperate button so I can connect it seperately and see the difference?

  8. #8
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    is the code in post#1 the latest version?
    Chris

  9. #9

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    No, not yet. I'll get it uploaded.


    Come to think of it, I don't think i've modified anything with my version. I don't know because this is a public pc (basically away from my pc), but i'm sure i haven't done much to it, so you can scrutinize it as much as you like

  10. #10
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    Are you still having problems or is this solved?
    Chris

  11. #11

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    I'm still having problems.

    The problem is I don't know where to start to solve the problem

  12. #12
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    i've tested it, chat works, i sent a file, works, i chatted more, works.....no errors??
    Chris

  13. #13

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    It actually worked??? My god that's something!!! I'll retest it again at home.

    Did you test it over two PCs? Because I tested it over one PC using the 127.0.0.1 ip and that kinda sucked.

  14. #14

    Thread Starter
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Winsock error

    Thanks dude it actually works !

    I wanted to rate your post, but it says i'll need to rate someone else before I can do you again, so I think I must've rated you before.

    Cheers for the help!

  15. #15
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Winsock error

    lol okay!
    Chris

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