Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. winsock error message

winsock error message

Scheduled Pinned Locked Moved C / C++ / MFC
help
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    d_lite
    wrote on last edited by
    #1

    Can anyone help me... I have build a simple listening socket program using winsock2 in windows xp. when i start the listening socket it works fine. i send 1000 concurent message in one time, the socket works fine. until i send 1000 message again, then the send application receive error message "address already in use" (WSAEADDRINUSE). then i shutdown the listening application and start it up again, then i try to send a message again using the same port, i cannot connect to the listening port, it says the same error. is there any way that i could done in order to get listening socket status if the send application receive that error. coz, once that error occure, i can't send any message to listening socket. i want to clean up the listening socket again so i can use it again. thanks... (( _; ) ((

    F 1 Reply Last reply
    0
    • D d_lite

      Can anyone help me... I have build a simple listening socket program using winsock2 in windows xp. when i start the listening socket it works fine. i send 1000 concurent message in one time, the socket works fine. until i send 1000 message again, then the send application receive error message "address already in use" (WSAEADDRINUSE). then i shutdown the listening application and start it up again, then i try to send a message again using the same port, i cannot connect to the listening port, it says the same error. is there any way that i could done in order to get listening socket status if the send application receive that error. coz, once that error occure, i can't send any message to listening socket. i want to clean up the listening socket again so i can use it again. thanks... (( _; ) ((

      F Offline
      F Offline
      Florin Ochiana
      wrote on last edited by
      #2

      So you have 2 apps: - a server - a client In the client you have the error WSAEADDRINUSE. You probably try to recreate a socket with the same port in the client after you send the first 1000 messages. Are you sure that the first transfer completed succesfully? If not the port will be opened, hence your error. If you shutdown the server while there are active connections to the socket, this will not close and the port will not be closed. Hence the error when you try to restart the server and it tries to bind on an already opened port. ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.

      D 1 Reply Last reply
      0
      • F Florin Ochiana

        So you have 2 apps: - a server - a client In the client you have the error WSAEADDRINUSE. You probably try to recreate a socket with the same port in the client after you send the first 1000 messages. Are you sure that the first transfer completed succesfully? If not the port will be opened, hence your error. If you shutdown the server while there are active connections to the socket, this will not close and the port will not be closed. Hence the error when you try to restart the server and it tries to bind on an already opened port. ----- We are what we repeatedly do. Excellence, then, is not an act, but a habit.

        D Offline
        D Offline
        d_lite
        wrote on last edited by
        #3

        Thanks for the reply, yes i have 2 apps, n i think i have to explain how those two works. server app works like any other server apps. it's listen to the port i have specify. in the client, it works like this. if i want to send 10 message for example, for the first message i create socket then i send it to server, after i have send it, i close the socket right away. when i want to send another one, i use the same method again. the reason i do this, because i want to simulate my server as if it was hit by noumerous connection in one time. the strange thing is, after the client receive that error, i shutdown the server, and i shut down the client. after that, when i try to connect to server without starting the server app, it retreive WSAEADDRINUSE rather than WSAECONNREFUSED error message. i have to wait for sometimes, than after that i can receive WSAECONNREFUSED error in my client app, which specify that the current port is not in use. during that time (when client app rec WSAEADDRINUSE with server app off), if i start my server app, it works just fine, there is no error message, as if it was in listen state normally. but when i try to send a message from the client app, i would receive WSAEADDRINUSE in my client app. is there any explaination about this? n how i should deal woth this problem? i was sure the transfer completed, coz i receive the message from the client n i close the client socket normaly too. (( _; ) ((

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups