Home All Groups Group Topic Archive Search About

Disposing unused sockets

Author
27 Jul 2006 1:23 PM
Christoph Duesmann
Hi !

My socket server doesn't remove the socket if a client is disconnected
suddenly (network problems etc.)
If the client starts the app again, it is existing two times in the servers
hashtable.

I don't know how to "dispose" the socket completely.

Any ideas ?

thanks a lot

Christoph duesmann

Author
27 Jul 2006 3:31 PM
tommaso.gastaldi
I don't know how and if you are doing a shutdown on both sides.
Can you show a scheme of you code? Are you using some finally or using
statement?

-tom

Christoph Duesmann ha scritto:

Show quoteHide quote
> Hi !
>
> My socket server doesn't remove the socket if a client is disconnected
> suddenly (network problems etc.)
> If the client starts the app again, it is existing two times in the servers
> hashtable.
>
> I don't know how to "dispose" the socket completely.
>
> Any ideas ?
>
> thanks a lot
>
> Christoph duesmann
Author
27 Jul 2006 4:35 PM
Michael D. Ober
Do you check for a read of 0 bytes?  This is how the Berkeley interface
identifies an unexpected (not shutdown) socket disconnection.

Mike Ober.

<tommaso.gasta***@uniroma1.it> wrote in message
Show quoteHide quote
news:1154014319.020227.254940@m73g2000cwd.googlegroups.com...
>
> I don't know how and if you are doing a shutdown on both sides.
> Can you show a scheme of you code? Are you using some finally or using
> statement?
>
> -tom
>
> Christoph Duesmann ha scritto:
>
>> Hi !
>>
>> My socket server doesn't remove the socket if a client is disconnected
>> suddenly (network problems etc.)
>> If the client starts the app again, it is existing two times in the
>> servers
>> hashtable.
>>
>> I don't know how to "dispose" the socket completely.
>>
>> Any ideas ?
>>
>> thanks a lot
>>
>> Christoph duesmann
>
Author
28 Jul 2006 3:55 AM
Christoph Duesmann
Hi !

Attached you will find two files: frmMain contains the code which is
responsible for waiting for connections. When a client want's to connect a
new instance of UserConnection ist created.

Hope this helps to understand.

Thanks

Christoph Duesmann

<tommaso.gasta***@uniroma1.it> schrieb im Newsbeitrag
Show quoteHide quote
news:1154014319.020227.254940@m73g2000cwd.googlegroups.com...
>
> I don't know how and if you are doing a shutdown on both sides.
> Can you show a scheme of you code? Are you using some finally or using
> statement?
>
> -tom
>
> Christoph Duesmann ha scritto:
>
>> Hi !
>>
>> My socket server doesn't remove the socket if a client is disconnected
>> suddenly (network problems etc.)
>> If the client starts the app again, it is existing two times in the
>> servers
>> hashtable.
>>
>> I don't know how to "dispose" the socket completely.
>>
>> Any ideas ?
>>
>> thanks a lot
>>
>> Christoph duesmann
>
>

[attached file: Code.zip]