[en] This class can send and receive UDP packets to a specific Internet IP address and port.
[ja] 特定のインターネットIPアドレスとポートに対してUDPパケットの送受信ができます。
More...
#include <LTEUDP.h>
Public Member Functions | |
LTEUDP () | |
Construct LTEUDP instance. | |
~LTEUDP () | |
Destruct LTEUDP instance. | |
uint8_t | begin (uint16_t port) |
Initialize, start listening on specified port. More... | |
void | stop () |
Finish with the UDP socket. More... | |
int | beginPacket (IPAddress ip, uint16_t port) |
Start building up a packet to send to the remote host specific in ip and port. More... | |
int | beginPacket (const char *host, uint16_t port) |
Start building up a packet to send to the remote host specific in host and port. More... | |
int | endPacket () |
Finish off this packet and send it. More... | |
size_t | write (uint8_t val) |
Write a single byte into the packet. More... | |
size_t | write (const uint8_t *buffer, size_t size) |
Write series of bytes from buffer into the packet. More... | |
int | parsePacket () |
Start processing the next available incoming packet. More... | |
int | available () |
Returns number of bytes remaining in the current packet. More... | |
int | read () |
Read a single byte from the current packet. More... | |
int | read (unsigned char *buffer, size_t len) |
Read up to len bytes from the current packet and place them into buffer. More... | |
int | read (char *buffer, size_t len) |
Read up to len characters from the current packet and place them into buffer. More... | |
int | peek () |
Return the next byte from the current packet without removing it. More... | |
void | flush () |
Discards any bytes that have been written to the packet. More... | |
IPAddress | remoteIP () |
Return the IP address of the host who sent the current incoming packet. More... | |
uint16_t | remotePort () |
Return the port of the host who sent the current incoming packet. More... | |
int | setTimeout (uint32_t milliseconds) |
Set the timeout when send or receive. More... | |
[en] This class can send and receive UDP packets to a specific Internet IP address and port.
[ja] 特定のインターネットIPアドレスとポートに対してUDPパケットの送受信ができます。
uint8_t LTEUDP::begin | ( | uint16_t | port | ) |
Initialize, start listening on specified port.
[en] Initialize, start listening on specified port.
[ja] クラスの初期化及び指定されたポートの接続を待ちます。
[in] | port | [en] Local port. [ja] ローカルポート番号。 |
void LTEUDP::stop | ( | ) |
Finish with the UDP socket.
[en] Finish with the UDP socket.
[ja] UDPソケットを閉じて終了します。
int LTEUDP::beginPacket | ( | IPAddress | ip, |
uint16_t | port | ||
) |
Start building up a packet to send to the remote host specific in ip and port.
[en] Start building up a packet to send to the remote host specific in ip and port.
[ja] 指定されたIPアドレスおよびポート番号でリモートホストに送信するパケットの構築を開始します。
[in] | ip | [en] Remote IP address. [ja] リモートIPアドレス。 |
[in] | port | [en] Remote port. [ja] リモートポート番号。 |
int LTEUDP::beginPacket | ( | const char * | host, |
uint16_t | port | ||
) |
Start building up a packet to send to the remote host specific in host and port.
[en] Start building up a packet to send to the remote host specific in host and port.
[ja] 指定されたホスト名およびポート番号でリモートホストに送信するパケットの構築を開始します。
[in] | host | [en] Remote host. [ja] リモートホスト名。 |
[in] | port | [en] Remote port. [ja] リモートポート番号。 |
int LTEUDP::endPacket | ( | ) |
Finish off this packet and send it.
[en] Finish off this packet and send it.
[ja] このパケットを終了して構築したパケットを送信します。
size_t LTEUDP::write | ( | uint8_t | val | ) |
Write a single byte into the packet.
[en] Write a single byte into the packet.
[ja] パケットに1バイトのデータを書き込みます。
[in] | val | [en] single byte. [ja] 書き込む値。 |
size_t LTEUDP::write | ( | const uint8_t * | buffer, |
size_t | size | ||
) |
Write series of bytes from buffer into the packet.
[en] Write series of bytes from buffer into the packet.
[ja] パケットに一連のデータを書き込みます。
[in] | buffer | [en] A buffer to send. [ja] 書き込みバッファー。 |
[in] | size | [en] The length of the buffer. [ja] 書き込みバッファーの長さ。 |
int LTEUDP::parsePacket | ( | ) |
Start processing the next available incoming packet.
[en] Start processing the next available incoming packet.
[ja] 次に利用可能な受信パケットの処理を開始します。
int LTEUDP::available | ( | ) |
Returns number of bytes remaining in the current packet.
[en] Returns number of bytes remaining in the current packet.
[ja] パケットの残りバイト数を返します。
int LTEUDP::read | ( | ) |
Read a single byte from the current packet.
[en] Read a single byte from the current packet.
[ja] 現在のパケットから1バイトを読み出します。
int LTEUDP::read | ( | unsigned char * | buffer, |
size_t | len | ||
) |
Read up to len bytes from the current packet and place them into buffer.
[en] Read up to len bytes from the current packet and place them into buffer.
[ja] 現在のパケットから最大lenバイトをバッファーに読み出します。
[out] | buffer | [en] A buffer to read. [ja] 受信バッファー。 |
[in] | len | [en] The length of the buffer. [ja] 受信バッファーの長さ。 |
int LTEUDP::read | ( | char * | buffer, |
size_t | len | ||
) |
Read up to len characters from the current packet and place them into buffer.
[en] Read up to len characters from the current packet and place them into buffer.
[ja] 現在のパケットから最大len文字をバッファーに読み出します。
[out] | buffer | [en] A buffer to read. [ja] 受信バッファー。 |
[in] | len | [en] The length of the buffer. [ja] 受信バッファーの長さ。 |
int LTEUDP::peek | ( | ) |
Return the next byte from the current packet without removing it.
[en] Return the next byte from the current packet without removing it.
[ja] 現在のパケットから削除せずにデータを読み出します。
void LTEUDP::flush | ( | ) |
Discards any bytes that have been written to the packet.
[en] Discards any bytes that have been written to the packet.
[ja] パケットに書き込まれたデータを破棄します。
IPAddress LTEUDP::remoteIP | ( | ) |
Return the IP address of the host who sent the current incoming packet.
[en] Return the IP address of the host who sent the current incoming packet.
[ja] 現在の受信パケットを送信したホストのIPアドレスを返します。
uint16_t LTEUDP::remotePort | ( | ) |
Return the port of the host who sent the current incoming packet.
[en] Return the port of the host who sent the current incoming packet.
[ja] 現在の受信パケットを送信したホストのポート番号を返します。
int LTEUDP::setTimeout | ( | uint32_t | milliseconds | ) |
Set the timeout when send or receive.
[en] Set the timeout send or receive. 0 means disabled (no timeout). If this method has not been called, the timeout is 0.
[ja] 送受信をする際のタイムアウトを設定します。0は無効(タイムアウトしない)を意味します。本メソッドを呼び出さない場合のタイムアウトは0です。