Link to home
Start Free TrialLog in
Avatar of jjescri
jjescri

asked on

destroying socket

Hi,

I have a loop that close a socket if it is not equal to NULL and create the socket again. I can execute this loop 255 times. Why? How can I destroy the socket in order to avoid this problem?

Thanks in advance.
Avatar of BlackDiamond
BlackDiamond

Can you post the code for this?  From your description, the order of the loop sounds like:

if the socket is not NULL, close it.
create a new socket (socket is not null anymore).
loop

Avatar of jjescri

ASKER

The loop is this

Begin Loop
  if the socket is not NULL, close it.
  create a new socket
End loop
your OS?
this is related to maximum file descriptors you can open at one time...
Avatar of jjescri

ASKER

My OS is Linux Red Hat 7.3
ASKER CERTIFIED SOLUTION
Avatar of cincin77
cincin77

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you elaborate on what it is you want your logic to do, and post some real code. It doesn't make much sense to continuously open and close your sockets (which is what you have said you are doing) without some other code in there to do something with them while they are open.  It would really help us to help you if you can tell us what the application needs to do, and show us what your current socket code looks like.  I don't think you will get any helpful comments otherwise (we can only guess what you are trying to do).

Thanks,
BD