Ethernet port Blocks

Hi I have two BL2500 , I am using TCP/ip to comunicate with a computer. My program seems to work fine but after some days of continuous use
one of the rabbits blocks the Ethernet port. I know that it only blocks the Ethernet port because the other ports, inputs and outputs, continue to work fine. Also, it is very weird because it is always the same rabbit that blocks the Ethernet port.

I know that in my code, I am not closing the socket when I write something in the function envia_msj. I am in a different city than my two BL2500, so I cannot modify directly my code to see if this is the problem. I am not sure though if it is necessary to close the socket. If so, I don’t understand why I am having this problem only in one of my machines.
I put part of the code, maybe some one can find the error.
Thanks

#define TCPCONFIG 1
#use “dcrtcp.lib”
#define LOCAL_PORT 2300

(en un user block defino esto con ip valida)
SETTINGS.ip_adr=aton(“0.0.0.0”);
SETTINGS.mas_adr=aton(“255.255.255.0”);
SETTINGS.rtr_adr=aton(“0.0.0.0”);

int inicia_red (void)
{
int activa;
char temp[16];

activa=sock_init(); //activo la red
delay (200);
if (activa!=0)
{
lcdClrScr();
dispS (" ERROR EN LA RED ");
delay (2000);
return 1;
}

												    // configuro la red

activa= ifconfig(IF_ETH0,

               IFS_IPADDR, SETTINGS.ip_adr,
               IFS_NETMASK, SETTINGS.mas_adr,
               IFS_ROUTER_SET, SETTINGS.rtr_adr,
               IFS_UP,
               IFS_END);

if (activa!=0)
{
lcdClrScr();
dispS (" PARAMETRO ERRONEO DE RED ");
delay (2000);
return 1;
}
else
{
lcdClrScr();
dispS ("Mi IP Address es: ");
inet_ntoa(temp,SETTINGS.ip_adr) ;
dispS (temp);
delay (2500);
}
ip_print_ifs();
return 0;
}

this part is in the main :

{

                 costate {

			// Handle incoming TCP requests.

			//	Listen for a connection request on the specified local port.
			tcp_listen(&server_socket,LOCAL_PORT,0,0,NULL,0);
			printf("Waiting for connection...

");
waitfor (connection_established());
printf("Connection established.
");
waitfor (check_for_received_data() || DelaySec(20));

        // Find out if data has been received.
			data_available = check_for_received_data();

			// If data has been received, service the request.
			if (data_available > 0) {
				service_request();
				}
			else {
				printf("Timeout: the remote host provided no data. 

");
}

			// The communications are complete, so close the connection.
			sock_close(&server_socket);
			printf("The connection is closed. 

");

		} // costate




}

when I use the tcp to send a msj I use this function (here is where I dont close the socket):

int envia_msj (int bytes, int posicion)
{
// Write the incremented byte to the socket to send it back to the sender.
return_value = sock_write(&server_socket, &server_buffer[posicion], bytes);
if (return_value != -1) {
printf("ENvio msj con exito
");
return 0;
}
else {
printf("Error writing to socket.
");
return 1;
}

}