Problem in FTP server, need to close socket asap.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem in FTP server, need to close socket asap.

1,188 Views
Nilson
Contributor I
Hi, there is my problem...
 
I have a ftp server listen on port 21 and another socket listen on port 5000. Port 5000 gets data from a PABX and writes in a flash.
 
When the flash is full, i need to close the port 5000 socket asap so i dont lose data, but what is happening is when i tell the port 5000 socket to close it takes some time and it doesnt stop to get data from pabx, so i lose data and there is a worst thing happening, the tcp buffers get full and everything stops working.
 
How do i clean those tcp buffers after i close the socket? Theres a way to close the socket immediatly?
 
Thanks.
Labels (1)
0 Kudos
2 Replies

317 Views
Nilson
Contributor I
Oh well, i thought i would have more trouble to solve this.
 
Setting the socket flags to as below did the job.
 
pabx_server_socket->so_options = SO_LINGER;
pabx_server_socket->linger = 0;  
 
pabx_communication_socket->so_options = SO_LINGER;
pabx_communication_socket->linger = 0;  
0 Kudos

317 Views
macl
Senior Contributor I
Just a friendly reminder, please include the product # in the subject line so everyone knows which device your are programming. 
 
Thanks,
macl
0 Kudos