2019-09-30 17:11:53 +08:00
|
|
|
|
## tk\_ostream\_udp\_t
|
|
|
|
|
### 概述
|
|
|
|
|
![image](images/tk_ostream_udp_t_0.png)
|
|
|
|
|
|
2019-10-16 09:02:32 +08:00
|
|
|
|
|
|
|
|
|
input stream base on socket
|
|
|
|
|
|
|
|
|
|
|
2019-09-30 17:11:53 +08:00
|
|
|
|
----------------------------------
|
|
|
|
|
### 函数
|
|
|
|
|
<p id="tk_ostream_udp_t_methods">
|
|
|
|
|
|
|
|
|
|
| 函数名称 | 说明 |
|
|
|
|
|
| -------- | ------------ |
|
|
|
|
|
| <a href="#tk_ostream_udp_t_tk_ostream_udp_create">tk\_ostream\_udp\_create</a> | |
|
|
|
|
|
| <a href="#tk_ostream_udp_t_tk_ostream_udp_set_target_with_addr">tk\_ostream\_udp\_set\_target\_with\_addr</a> | |
|
|
|
|
|
| <a href="#tk_ostream_udp_t_tk_ostream_udp_set_target_with_host">tk\_ostream\_udp\_set\_target\_with\_host</a> | |
|
|
|
|
|
#### tk\_ostream\_udp\_create 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-10-16 09:02:32 +08:00
|
|
|
|
> <p id="tk_ostream_udp_t_tk_ostream_udp_create">
|
|
|
|
|
创建ostream对象。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-30 17:11:53 +08:00
|
|
|
|
|
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
tk_ostream_t* tk_ostream_udp_create (int sock);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | tk\_ostream\_t* | 返回ostream对象。 |
|
|
|
|
|
| sock | int | socket. |
|
|
|
|
|
#### tk\_ostream\_udp\_set\_target\_with\_addr 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-10-16 09:02:32 +08:00
|
|
|
|
> <p id="tk_ostream_udp_t_tk_ostream_udp_set_target_with_addr">
|
|
|
|
|
设置目标。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-30 17:11:53 +08:00
|
|
|
|
|
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_ostream_udp_set_target_with_addr (tk_ostream_t* stream, struct sockaddr_in addr);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| stream | tk\_ostream\_t* | ostream对象。 |
|
|
|
|
|
| addr | struct sockaddr\_in | 地址。 |
|
|
|
|
|
#### tk\_ostream\_udp\_set\_target\_with\_host 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-10-16 09:02:32 +08:00
|
|
|
|
> <p id="tk_ostream_udp_t_tk_ostream_udp_set_target_with_host">
|
|
|
|
|
设置目标。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-30 17:11:53 +08:00
|
|
|
|
|
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_ostream_udp_set_target_with_host (tk_ostream_t* stream, const char* host, int port);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| stream | tk\_ostream\_t* | ostream对象。 |
|
|
|
|
|
| host | const char* | 主机或IP。 |
|
|
|
|
|
| port | int | 端口。 |
|