Using Ethernet.lib

raoul
2006-07-21
2006-07-24
  • raoul - 2006-07-21

    Hello all.

    I'm trying to use the Ethernet.lib library with a 750-842 controller. I want to make an UDP server listenning to UDP packet wich are broadcasted on the network.

    I'm doing this:

    VAR
    socket: ETHERNET_SERVER_OPEN;
    Read: ETHERNET_READ;
    END_VAR
    IF (socket.SOCKET = 0) THEN
    Β  Β  socket(EN:=1, TYP:=SOCK_DGRAM, PROTO:=IPPROTO_UDP, PORT:=4545);
    END_IF
    Read(EN:=1, SOCKET:=socket.SOCKET, DATA:=buffer);
    Read(EN:=0, DATA:=buffer);
    IF (Read.LEN_OUT > 0) THEN
    Β  Β  (* Do somthing *)
    END_IF
    

    The socket is successfully created with no error, but when a packet comes nothing is read from the ETHERNET_READ function block...

    Why? Does anybody know if I've done something wrong?

    Thank

    Raoul

     
  • Erik BΓΆhm - 2006-07-24

    Hi

    Did you try it like this:

    Read(EN:=1, SOCKET:=socket.SOCKET, DATA:=buffer);

    IF (Read.LEN_OUT > 0) THEN

    Read(EN:=0, DATA:=buffer);
    
    (* Do somthing *)
    

    END_IF

     
  • raoul - 2006-07-24

    Yes I tried that, but It's exactly the same...

    Raoul

     
  • Erik BΓΆhm - 2006-07-24

    Hi

    I have a (fully working and tested) Sample for you.

    Maybe it helps you to understand the mechanism.

    Greets

    Erik

    WagoEthernetServer.zip [12.42 KiB]

     
  • raoul - 2006-07-24

    Thank you, I'll try this example...

    Raoul

     

Log in to post a comment.