Re: Bind fails with an error port is in use.
- From: Heath Raftery <hraftery@xxxxxxxxxxxxx>
- Date: Thu, 07 Feb 2008 05:25:46 GMT
avakharia_ibsdev@xxxxxxxxx <avakharia_ibsdev@xxxxxxxxx> wrote:
I have used SetSockOpt - SO_REUSEADDR before bind function.
Can you post this area of code? There are couple of minor
variations of theme that might be significant.
In particular case i am getting SetSockOpt functions completes with No
error but still bind fucntion fails with error that port is in use.
That may well be the case - as I think you are aware, REUSEADDR only
bypasses some checks when binding to a port. If the port is indeed
bound by another process, the second bind will still fail.
Case is i have three users of my MAC machine. User A logged
in,Application is successfull to bind the port and client also gets
connected successfully. Now i m closing my Client server application
and switching to another user and try to run my server application.
Here my socket cannot able to bind on port and fails with an error
that it is in Use. Suprisingly if i try with after 1 or 2 minutes it
gets binded successfully.
It is here bit difficult to judge why this is happing only when
switching the user. As if I run my application number of time in same
user it will never give me such error.
Wow, that's interesting. I've never heard of multiple users causing
problems, but then again I'd say that would be a rare situation.
Generally anything that binds to a port and listens as a server
will be run by one superuser and only once. Not that that should
prevent you from doing what you want.
The 1-2 minutes thing certainly does sound like REUSEADDR should
fix it up though.
Either i force terminate the
process or close it smoothly.
Ah, but does the process close() the socket it bound to?
I don't think this is a MACOSX problem or Objective - C problem. I
still looking into my code and find the solution of this.
Post some relevant code if you want a few more eyes to help you
out.
--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m_________*
.
- Follow-Ups:
- Re: Bind fails with an error port is in use.
- From: avakharia_ibsdev@xxxxxxxxx
- Re: Bind fails with an error port is in use.
- References:
- Bind fails with an error port is in use.
- From: avakharia_ibsdev@xxxxxxxxx
- Bind fails with an error port is in use.
- Prev by Date: FREE Newsletter shows you how to become a $100,000 earner:
- Next by Date: Re: creating image thumbnails is slow in java, suggestions for improvement?
- Previous by thread: Bind fails with an error port is in use.
- Next by thread: Re: Bind fails with an error port is in use.
- Index(es):
Relevant Pages
|