Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface mbed-rtos mbed
Fork of mbed_driver_ver_0_2_0 by
Revision 3:c8ae2c222d57, committed 2018-10-28
- Comitter:
- yukisega
- Date:
- Sun Oct 28 04:35:33 2018 +0000
- Parent:
- 2:233951f9354d
- Commit message:
- client????????????
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Oct 22 15:48:49 2018 +0000
+++ b/main.cpp Sun Oct 28 04:35:33 2018 +0000
@@ -75,11 +75,7 @@
*
* @brief コネクション時に重大なエラーが発生した時に呼び出されます
*
- * pwmをduty比それぞれ50%にしてから、
- * mbedOSに−1を返します。
- * \htmlonly
- * <font color="red">こうなった場合は再起動が必要です。</font>
- * \endhtmlonly
+ * pwmをduty比それぞれ50%にします
*
*
*/
@@ -100,9 +96,6 @@
* RTOSによって管理されているスレッドで,
* TCPSocketの確立前にデータリンク層あたりでコネクションされていないと
* mbedOSに−1を返します。
- * \htmlonly
- * <font color="red">mbedの電源を投入する前に,あらかじめクライアントのコンピュータを接続しておく必要があります。</font>
- * \endhtmlonly
*/
void ethernet_thread(void){
char in_buf[64];
@@ -119,16 +112,16 @@
while (true) {
printf("\nWait for new connection...\n");
- TCPSocketConnection client;
- server.accept(client);
+ TCPSocketConnection *client = new TCPSocketConnection;
+ server.accept(*client);
//client.set_blocking(false, TIMEOUT_MS); // Timeout after (TIMEOUT_MS)ms
- printf("Connection from: %s\n", client.get_address());
+ printf("Connection from: %s\n", client->get_address());
- while (client.is_connected()) {
+ while (client->is_connected()) {
Ethconnect_LED = 1;
- int len = client.receive(in_buf, sizeof(in_buf));
+ int len = client->receive(in_buf, sizeof(in_buf));
EthRecv_LED = !EthRecv_LED;
// print received message to terminal
in_buf[len] = '\0';
@@ -150,7 +143,8 @@
printf("\nclient closed\n");
Ethconnect_LED = 0;
timeout();
- client.close();
+ client->close();
+ delete client;
}
}
