Re: [eclipse-clp-users] Socket between C and ECLiPSe

From: Kish Shen <kisshen_at_...5...>
Date: Wed, 25 Jul 2012 20:00:36 +0100
Hi Sabri,

On 25/07/2012 11:57, sabri allaoui wrote:
> Hi,
> I'am working on porting a program from UNIX to Windows. In Unix, the
> connection between C and ECLiPSe is done via Streams (FILE *).
> The problem is in Windows. For C : The sockets are no longer file
> descriptor and so cannot be linked to streams. But for ECLiPSe, it's still
> the case.

I think you need to give more details of how your program is connecting 
between C and ECLiPSe, as I can't figure out exactly what you are doing.

For example, are you connecting from ECLiPSe to C at the ECLiPSe level, 
or are you using ECLiPSe's C interface? Are you forming a socket 
connection (using socket/3 at the ECLiPSe level, or the socket() system 
call at the C level)?

If you are indeed using sockets, then I am not sure I understand what 
you mean by connection is done "via Streams (FILE *)", because (FILE *)
is not what the C socket() supports --

The C socket() requires you to specify a domain, a type (which can be a 
SOCK_STREAM -- is this what you mean by STREAM?), and a protocal 
(normally left as 0). The socket() call returns a "file descriptor", but 
this is of type int, not (FILE *).

At the ECLiPSe level, you can specify the domain and type in the 
socket/3 call.

As I said, it is difficult to be sure what you exact problem is without 
more information, but at a guess, I would say (if you are indeed using 
sockets) that you are using domain and/or type that only works on Linux 
and not Windows.

If you are calling socket/3 at the ECLiPSe level, there are limited 
choices for  domain, and only the internet domain (PF_INET at the C 
level) works for both Unix and Windows. Is this what you are using?

In summary, for portability, if you use sockets, you should set them up 
with the internet domain (PF_INET), and probably as type stream 
(SOCK_STREAM) -- ECLiPSe itself has  code that does this, and they work 
on both Unix and Windows.



> The thing is when I try to receive two or more massages from ECLiPSe, only

> the first one is detected by C.
> So I am wondering is it a C problem or an ECLiPSe one?
> I am using send and recv functions in C after establishing the connection.
> Regards,
> Sabri
> This body part will be downloaded on demand.
> This body part will be downloaded on demand.

This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Wed Jul 25 2012 - 19:35:33 CEST

This archive was generated by hypermail 2.2.0 : Mon Jul 09 2018 - 02:05:29 CEST