Re: Problem with select/5 on AF_INET sockets with Windows 7

Paulo Moura <[email protected]> Thu, 19 Feb 2015 19:40:45 +0000
Newsgroups gmane.comp.gnu.prolog.bugs
Message-ID <[email protected]>
> On 19/02/2015, at 19:11, Fx <[email protected]> wrote:
> =

> :)) Paulo, you are right, if it can help. I won=92t promise anything, but=
 i can at least take a look, sure.
> =

> Can you help, and tell me where cans i found some infos:
> - What are actually the tools (or info link )to compile under Windows (7,=
32b my office copmuter)
> - What are actually the tools (or info link )to compile under Os X (this =
one is really rather a computer, my personnal(s) one(s)).

I cannot help you with building GNU Prolog on Windows but, on Mac OS X, jus=
t follow the steps in the INTALL file.

> Dont=92 they exists some kinda unit tests ? Prolog coded scenario ?  Or a=
 Jenkins like for massive testing ?

Logtalk includes a Prolog conformance test suite but it only tests, as it n=
ames indicates, standards related stuff. The small number of conformance is=
sues are known (and some of them are really limitations in the standard). I=
 cannot speak for Daniel, of course, but testing of other (non-standard) fe=
atures would like be more useful. Specially stuff this might behave differe=
ntly across different operating-systems (like sockets :-).

Cheers,

Paulo

> Le 19 f=E9vr. 2015 =E0 20:00, Paulo Moura <[email protected]> a =E9crit :
> =

>> =

>>> On 19/02/2015, at 18:58, Fx <[email protected]> wrote:
>>> =

>>> Daniel,
>>> =

>>> Thank you very much for your answer, and this is a great news for 1.4.5=
 !!!
>>> =

>>> I=92ll be patient and wait for the official distribution.
>> =

>> Don't be patient. Help instead beta-testing 1.4.5.
>> =

>> Cheers,
>> =

>> Paulo
>> =

>> =

>>> Le 17 f=E9vr. 2015 =E0 13:32, Daniel Diaz <[email protected]> =
a =E9crit :
>>> =

>>>> Hi,
>>>> =

>>>> sorry for the late reply. Thank you for this bug report.
>>>> =

>>>> The bug is fixed in the last git version. Will be fixed in next 1.4.5
>>>> =

>>>> Daniel
>>>> =

>>>> =

>>>> =

>>>> Le 27/01/2015 12:44, [email protected] a =E9crit :
>>>>> Dear Daniel,
>>>>> =

>>>>> I am working on a specific http server for gnu prolog (1.4.4), and i =
discovered
>>>>> a strange comportment under windows 7 (32) with the select/5 predicat=
e.
>>>>> =

>>>>> The simple test below works fine on a OSX (maybe all unix) system but=
 will
>>>>> return a system error under Windos 7 (32) , "Bad File Descriptor":
>>>>> =

>>>>> ERROR : Failed to start server : error(system_error(Bad file
>>>>> descriptor),select/5)
>>>>> =

>>>>> To test, launch one of the two test cases and open an internet browse=
r to
>>>>> http://127.0.0.1:8080/ for example, or change the 127.0.0.1 by your I=
P.
>>>>> =

>>>>> %- Program Test with Select -----------------------------------
>>>>> =

>>>>> worker_run(Socket, Client, StreamIn, StreamOut):- write('i am a worki=
ng worker
>>>>> ...'), nl.
>>>>> =

>>>>> server_test_with_select:-
>>>>> 	socket('AF_INET', Socket),
>>>>> 	socket_bind(Socket, 'AF_INET'(Host, 8080)),
>>>>> 	socket_listen(Socket,10),
>>>>> 	catch( 	server_loop_with_select(Socket),E,
>>>>> 		 ( 	socket_close(Socket),
>>>>> 			format( "ERROR : Failed to start server : ~w~n", [E] )
>>>>> 	)).
>>>>> =

>>>>> server_loop_with_select(Socket):-
>>>>> 	repeat,
>>>>> 		select([Socket],ReadyReads,[Socket],[],0),
>>>>> 		worker_run(Socket, Client, StreamIn, StreamOut),
>>>>> 	fail.
>>>>> =

>>>>> %- End of Program Test with Select -----------------------------------
>>>>> =

>>>>> When not using usefull select/5 and directly use the socket_accept/4 =
predicate
>>>>> the server works well.
>>>>> =

>>>>> =

>>>>> %- Program Test without Select -----------------------------------
>>>>> =

>>>>> worker_run(Socket, Client, StreamIn, StreamOut):- write('i am a worki=
ng worker
>>>>> ...'), nl.
>>>>> =

>>>>> server_test_without_select:-
>>>>> 	socket('AF_INET', Socket),
>>>>> 	socket_bind(Socket, 'AF_INET'(Host, 8080)),
>>>>> 	socket_listen(Socket,10),
>>>>> 	catch( 	server_loop_without_select(Socket),E,
>>>>> 		 ( 	socket_close(Socket),
>>>>> 			format( "ERROR : Failed to start server : ~w~n", [E] )
>>>>> 	)).
>>>>> =

>>>>> server_loop_without_select(Socket):-
>>>>> 	repeat,
>>>>> 		socket_accept(Socket, Client, StreamIn, StreamOut),
>>>>> 		worker_run(Socket, Client, StreamIn, StreamOut),
>>>>> 	fail.
>>>>> =

>>>>> %- End of Program Test without Select -------------------------------=
----
>>>>> =

>>>>> =

>>>>> Is it a known bug and did you plan to fix it in a future version ?
>>>>> =

>>>>> =

>>>>> Best Regards,
>>>>> =

>>>>> Fx NION.
>>>>> =

>>>>> =

>>>>> _______________________________________________
>>>>> Bug-prolog mailing list
>>>>> [email protected]
>>>>> https://lists.gnu.org/mailman/listinfo/bug-prolog
>>>>> =

>>>> =

>>>> =

>>>> -- =

>>>> Ce message a ete verifie par MailScanner
>>>> pour des virus ou des polluriels et rien de
>>>> suspect n'a ete trouve.
>>>> =

>>> =

>>> =

>>> _______________________________________________
>>> Bug-prolog mailing list
>>> [email protected]
>>> https://lists.gnu.org/mailman/listinfo/bug-prolog
>> =

>> -----------------------------------------------------------------
>> Paulo Moura
>> Logtalk developer
>> =

>> Email: <mailto:[email protected]>
>> Web:   <http://logtalk.org/>
>> -----------------------------------------------------------------
>> =

>> =

>> =

>> =

> =


-----------------------------------------------------------------
Paulo Moura
Logtalk developer

Email: <mailto:[email protected]>
Web:   <http://logtalk.org/>
-----------------------------------------------------------------