On Tue, 16 Feb 2010, Maurilio Longo wrote: Hi,
> I'm writing a ftpd server, when a transfer is happening and, for example, I > have an error writing data to disk I have to stop incoming data and notify > client that the transfer has been aborted. > > Looking around I've seen that one solution is to shutdown() the socket and > receive pending data while sending on the control socket a code telling the > client I've aborted the transfer. Why do you need to receive pending data in such situation? > hb_InetClose() does an automatic shutdown, I saw it, but I think that a > following hb_InetRecv() on a closed socket will give me an error. Yes, it will return error but it should not be a problem for you. HB_INET*() functions in Harbour have protection against using closed sockets in low level functions. > Maybe I can just don't bother, close the socket and send the abort code, I > admit that I've not made tests since adding hb_InetShutdown() seemed to me so > easy .) I think it will work without any problems. Anyhow this function can be usable in some cases i.e. to should down only one side of connection so we can add it. But it's possible that on some platforms it will not interrupt select() executed on shutdown stream so probably it will be good to save socket shutdown status in PHB_SOCKET_STRUCT and extend hb_inetIsOpen() function to check if socket can be used to READ and/or WRITE data. best regards, Przemek _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour