Home Help Center

ICE & UDP and netinet/in.h

catalincatalin Member ✭✭
Hi!

Using ICE 1.2.0 on RedHat 9.0 with gcc 3.2:

I want to implement a service based on the UDP protocol. A client will invoke a server with a request and the server is to start serving the request by sending data in UDP diagrams, until it finishes all there is to send.

I know that with ICE calls to a server's interfaces can be implemented by means of the UDP protocol as well, but since the server will return a lot of data, I do not want the client to poll it for each bit. I also do not want to use the TCP protocol.

1) Can this be implemented by means of pure ICE API? I'm tinking in terms similar of ICE's threading library. One can use this library instead of, say, pthread. Is there an ICE library which can be used instead of implementing Unix sockets in the traditional way?

2) Assuming the answer to the previous question is no, I am trying to implement the server as a mixture of ICE and traditional sockets. To this end I need to #include <netinet/in.h>, which among other things defines struct sockaddr_in . When doing this I get the following error (I skip what doesn't have to do with ICE):
In file included from /opt/Ice-1.2.0/include/IceUtil/Shared.h:18,
from /opt/Ice-1.2.0/include/IceUtil/Thread.h:18,

<skip>

/opt/Ice-1.2.0/include/IceUtil/Config.h:199: `INT64_MIN' was not declared in
this scope
/opt/Ice-1.2.0/include/IceUtil/Config.h:200: `INT64_MAX' was not declared in
this scope
make: *** [testAppo] Error 1


Any idea how to fix this?

Thanks,
Catalin

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Re: ICE & UDP and netinet/in.h
    Originally posted by catalin
    Hi!

    Using ICE 1.2.0 on RedHat 9.0 with gcc 3.2:

    I want to implement a service based on the UDP protocol. A client will invoke a server with a request and the server is to start serving the request by sending data in UDP diagrams, until it finishes all there is to send.

    I know that with ICE calls to a server's interfaces can be implemented by means of the UDP protocol as well, but since the server will return a lot of data, I do not want the client to poll it for each bit. I also do not want to use the TCP protocol.

    There is no need to poll. The server can push the data to the client. I.e., create Ice objects in your client, register them with an OA in the client, and send a proxy for these Ice objects to the server. Then the server can send callbacks to the client by simply invoking on the proxies. This works regardless of the protocol.

    Have a look at demo/Ice/callback. This demonstrates how this works for all supported protocols, including UDP.

    In case firewalls are a concern for callbacks, then you should use Glacier.
    Originally posted by catalin

    1) Can this be implemented by means of pure ICE API? I'm tinking in terms similar of ICE's threading library. One can use this library instead of, say, pthread. Is there an ICE library which can be used instead of implementing Unix sockets in the traditional way?

    No, Ice does not have a socket abstraction library that is intended to be used from user code.
    Originally posted by catalin

    2) Assuming the answer to the previous question is no, I am trying to implement the server as a mixture of ICE and traditional sockets. To this end I need to #include <netinet/in.h>, which among other things defines struct sockaddr_in . When doing this I get the following error (I skip what doesn't have to do with ICE):
    In file included from /opt/Ice-1.2.0/include/IceUtil/Shared.h:18,
    from /opt/Ice-1.2.0/include/IceUtil/Thread.h:18,

    <skip>

    /opt/Ice-1.2.0/include/IceUtil/Config.h:199: `INT64_MIN' was not declared in
    this scope
    /opt/Ice-1.2.0/include/IceUtil/Config.h:200: `INT64_MAX' was not declared in
    this scope
    make: *** [testAppo] Error 1


    Any idea how to fix this?

    Thanks,
    Catalin

    I would need to see exactly what you are including, and in which order. We include netinet/in.h in many places (for example, in src/Ice/UdpTransceiver.h), and there are no problems.
  • catalincatalin Member ✭✭
    I would need to see exactly what you are including, and in which order. We include netinet/in.h in many places (for example, in src/Ice/UdpTransceiver.h), and there are no problems.

    1) In the file where the error occurs I include:

    #include <errno.h> /* obligatory includes */
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>

    #include "moduleI.h"

    2) moduleI.h includes:

    #include "moduleB.h" // doesn't include anything of interest
    #include "moduleT.h"

    3) moduleT.h includes

    #include "module.h" // includes only <string>
    #include <IceUtil/Thread.h>
  • catalincatalin Member ✭✭
    I don't understand what's wrong, and why this fix works, but one work around this problem is to reorder the includes like this

    #include "moduleI.h"
    // this file includes another file which includes IceUtil/Thread.h

    #include <errno.h> /* obligatory includes */
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>

    instead of how they were when I couldn't compile:

    #include <errno.h> /* obligatory includes */
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>

    #include "moduleI.h"
    // this file includes another file which includes IceUtil/Thread.h

    The main thing is though that it works.

    Catalin
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    In general, Ice header files aren't meant to be included separately. Instead, the idea is to just include Ice.h.

    It's possibly that some of our dependencies aren't quite right in the header files. If you can put together a stand-alone example that demostrates the problem, I'll have a look and see what we can do.

    Cheers,

    Michi.
Sign In or Register to comment.