Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -rupN Ethernet//EthernetUdp.cpp Ethernet_udpttl//EthernetUdp.cpp
- --- Ethernet//EthernetUdp.cpp 2012-05-22 07:54:20.000000000 +0200
- +++ Ethernet_udpttl//EthernetUdp.cpp 2012-12-29 14:13:24.795716711 +0100
- @@ -98,6 +98,12 @@ int EthernetUDP::beginPacket(IPAddress i
- return startUDP(_sock, rawIPAddress(ip), port);
- }
- +int EthernetUDP::beginPacket(IPAddress ip, uint16_t port, uint8_t ttl)
- +{
- + _offset = 0;
- + return startUDP(_sock, rawIPAddress(ip), port, ttl);
- +}
- +
- int EthernetUDP::endPacket()
- {
- return sendUDP(_sock);
- diff -rupN Ethernet//EthernetUdp.h Ethernet_udpttl//EthernetUdp.h
- --- Ethernet//EthernetUdp.h 2012-05-22 07:54:20.000000000 +0200
- +++ Ethernet_udpttl//EthernetUdp.h 2012-12-29 14:13:59.419716722 +0100
- @@ -60,6 +60,7 @@ public:
- // Start building up a packet to send to the remote host specific in ip and port
- // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port
- virtual int beginPacket(IPAddress ip, uint16_t port);
- + virtual int beginPacket(IPAddress ip, uint16_t port, uint8_t ttl);
- // Start building up a packet to send to the remote host specific in host and port
- // Returns 1 if successful, 0 if there was a problem resolving the hostname or port
- virtual int beginPacket(const char *host, uint16_t port);
- diff -rupN Ethernet//utility/socket.cpp Ethernet_udpttl//utility/socket.cpp
- --- Ethernet//utility/socket.cpp 2012-12-29 14:06:04.595716561 +0100
- +++ Ethernet_udpttl//utility/socket.cpp 2012-12-29 14:10:34.027716652 +0100
- @@ -376,6 +376,13 @@ int startUDP(SOCKET s, uint8_t* addr, ui
- }
- }
- +int startUDP(SOCKET s, uint8_t* addr, uint16_t port, uint8_t ttl)
- +{
- + if (!startUDP(s, addr, port)) return 0;
- + W5100.writeSnTTL(s, ttl);
- + return 1;
- +}
- +
- int sendUDP(SOCKET s)
- {
- W5100.execCmdSn(s, Sock_SEND);
- diff -rupN Ethernet//utility/socket.h Ethernet_udpttl//utility/socket.h
- --- Ethernet//utility/socket.h 2012-05-22 07:54:20.000000000 +0200
- +++ Ethernet_udpttl//utility/socket.h 2012-12-29 14:10:56.199716660 +0100
- @@ -24,6 +24,7 @@ extern uint16_t igmpsend(SOCKET s, const
- @return 1 if the datagram was successfully set up, or 0 if there was an error
- */
- extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port);
- +extern int startUDP(SOCKET s, uint8_t* addr, uint16_t port, uint8_t ttl);
- /*
- @brief This function copies up to len bytes of data from buf into a UDP datagram to be
- sent later by sendUDP. Allows datagrams to be built up from a series of bufferData calls.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement