Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread silvioprog
2013/5/4 Ludo Brands > On 05/03/2013 05:57 PM, silvioprog wrote: > > Could you give me an example in practice? Theoretically I understand, > > but I don't know do in practice. :/ > > > > Now, TTcpIpServer is working well. The new problem is: when I close the > > server with one or more clients co

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ludo Brands
On 05/03/2013 05:57 PM, silvioprog wrote: > > Could you give me an example in practice? Theoretically I understand, > but I don't know do in practice. :/ > > Now, TTcpIpServer is working well. The new problem is: when I close the > server with one or more clients connected, I got a memory leak.

[fpc-pascal] How to detect if a project is a simple program or a application?

2013-05-03 Thread silvioprog
Hello, I'm trying to detect if a project is a simple program or a application. Please download a small test here: https://www.dropbox.com/s/w6a9gb4b9hnjit5/prova.zip On Windows it works fine, but on Linux not. -- Silvio Clécio My public projects - github.com/silvioprog

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ewald
On 03 May 2013, at 22:56, Zaher Dirkey wrote: > > On Fri, May 3, 2013 at 11:47 PM, Zaher Dirkey wrote: > On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort wrote: > > That's the point. Don't. Use a select, it has a timeout, and accept only if > select shows activity on the listened to socket

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 11:47 PM, Zaher Dirkey wrote: > On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort wrote: > >> >> That's the point. Don't. Use a select, it has a timeout, and accept only >> if >> select shows activity on the listened to socket. > > > ​Not sure, but i believe i used it in

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 11:27 PM, Marco van de Voort wrote: > > That's the point. Don't. Use a select, it has a timeout, and accept only if > select shows activity on the listened to socket. ​Not sure, but i believe i used it in the past and have problems with it, We can leave it to silvio to te

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ewald
On 03 May 2013, at 20:13, Marco van de Voort wrote: > In our previous episode, Ewald said: >> >> The point being that the answer to one of the OP sub-problems [the one >> quoted _partially_ above], can be to either use: >> - pthread_cancel() [overkill, I know, but nonetheless a solution] >> - no

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Marco van de Voort
In our previous episode, Zaher Dirkey said: > On Fri, May 3, 2013 at 9:13 PM, Marco van de Voort wrote: > > > Select on the main socket before doing the accept? > > > ?No i am not use Select before Accept, accept is blocking the thread. That's the point. Don't. Use a select, it has a timeout,

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 9:13 PM, Marco van de Voort wrote: > Select on the main socket before doing the accept? ​No i am not use Select before Accept, accept is blocking the thread. Best Regards Zaher Dirkey ___ fpc-pascal maillist - fpc-pascal@list

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread silvioprog
Fixed all errors: https://bitbucket.org/silvioprog/tcpipcomp/src/273b28b52b30621ffb4955e1136f8a06c160d20a/src/tcpipserver.pas?at=master I'll test this class severely. -- Silvio Clécio My public projects - github.com/silvioprog ___ fpc-pascal maillist

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Marco van de Voort
In our previous episode, Ewald said: > > The point being that the answer to one of the OP sub-problems [the one > quoted _partially_ above], can be to either use: > - pthread_cancel() [overkill, I know, but nonetheless a solution] > - non-blocking sockets [not very code-efficient IMHO if you only

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ewald
Once upon a time, Zaher Dirkey said: > On Fri, May 3, 2013 at 7:22 PM, Ewald wrote: > >> "Accept" but without errors > > ​You cant, Accept give you a handle of new socket or give you an error, not > all is fatal error, just check what is it, if it a closed handle or > shutdown.​ Yes, I know that.

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread silvioprog
2013/5/3 Zaher Dirkey > > On Fri, May 3, 2013 at 6:57 PM, silvioprog wrote: > >> when I close the server with one or more clients connected, I got a >> memory leak. > > > Check if the thread freed? > Try to stop server manually (by button or in Close event in the form) > > Best Regards > Zaher D

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 7:22 PM, Ewald wrote: > "Accept" but without errors ​You cant, Accept give you a handle of new socket or give you an error, not all is fatal error, just check what is it, if it a closed handle or shutdown.​ Best Regards Zaher Dirkey __

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 6:57 PM, silvioprog wrote: > when I close the server with one or more clients connected, I got a memory > leak. ​Check if the thread freed​? ​Try to stop server manually (by button or in Close event in the form)​ Best Regards Zaher Dirkey

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ewald
On 03 May 2013, at 11:30, Zaher Dirkey wrote: > > On Fri, May 3, 2013 at 12:18 PM, Ewald wrote: > That's true, but at least it returns control to you (= the programmer), so > you can close the handles manually. > > ​I am notprefer force to close any thing, that will make more bugs in your >

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread silvioprog
2013/5/3 Ludo Brands > On 05/02/2013 10:00 PM, silvioprog wrote: > > > > Lines 277 and 278. That is, I already do that. The problem now is how to > > stop the "Accept" but without errors. > > > > I implemented the "Stop" method in socket, but I did not want to do it > > this ugly way. > > > > Sam

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Zaher Dirkey
On Fri, May 3, 2013 at 12:18 PM, Ewald wrote: > That's true, but at least it returns control to you (= the programmer), so > you can close the handles manually. ​I am notprefer force to close any thing, that will make more bugs in your application​, while it is work fine with other programmesr

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-03 Thread Ewald
On 03 May 2013, at 00:15, Zaher Dirkey wrote: > > On Fri, May 3, 2013 at 12:51 AM, Ewald wrote: > pthread_cancel() > > pthread_cancel() ​ ​​ not clos​e​ the handles i though​.​ That's true, but at least it returns control to you (= the programmer), so you can close the handles manually. --