diff --git a/examples/proto_debuger/proto_debuger.vcxproj b/examples/proto_debuger/proto_debuger.vcxproj index 0d64cefe..ab7ce909 100644 --- a/examples/proto_debuger/proto_debuger.vcxproj +++ b/examples/proto_debuger/proto_debuger.vcxproj @@ -174,6 +174,7 @@ + @@ -190,6 +191,7 @@ + diff --git a/examples/proto_debuger/proto_debuger.vcxproj.filters b/examples/proto_debuger/proto_debuger.vcxproj.filters index 08a8367f..6cbdfde1 100644 --- a/examples/proto_debuger/proto_debuger.vcxproj.filters +++ b/examples/proto_debuger/proto_debuger.vcxproj.filters @@ -57,6 +57,9 @@ 源文件 + + 源文件 + @@ -98,6 +101,9 @@ 头文件 + + 头文件 + diff --git a/examples/proto_debuger/tcp_client.lua b/examples/proto_debuger/tcp_client.lua index 3f564540..8fdcc8a4 100644 --- a/examples/proto_debuger/tcp_client.lua +++ b/examples/proto_debuger/tcp_client.lua @@ -1 +1 @@ -require("string") function OnNewClient(ip,port) showdata("on new client from lua " .. ip..port.."32232323\r\n") end function OnClientRecvData(data) showdata("client recieve data from lua "..data.."\r\n") end function OnClientDisconnect(ip,port) showdata("client leave from lua " .. ip..port) end \ No newline at end of file +require("string") function OnNewClient(ip,port) showdata("on new client from lua " .. ip..port.."32232323\r\n") end function OnClientRecvData(data) showdata("client recieve data from lua "..data.."+++12312312\r\n") end function OnClientDisconnect(ip,port) showdata("client leave from lua " .. ip..port) end \ No newline at end of file diff --git a/examples/proto_debuger/tcp_client_form.cpp b/examples/proto_debuger/tcp_client_form.cpp index bbe6f736..ccdace47 100644 --- a/examples/proto_debuger/tcp_client_form.cpp +++ b/examples/proto_debuger/tcp_client_form.cpp @@ -47,24 +47,20 @@ void TcpClientForm::ShowDataInEdit(const char*p) { void TcpClientForm::Init() { ui::ChildBox::Init(); - m_label_1 = dynamic_cast(FindSubControl(L"uart_info_label")); m_rich_edit_1 = dynamic_cast(FindSubControl(L"uart_recv_eidt")); m_rich_edit_2 = dynamic_cast(FindSubControl(L"lua_script")); m_uart_send_edit = dynamic_cast(FindSubControl(L"uart_send_edit")); m_btn_send_data = dynamic_cast(FindSubControl(L"btn_send_data")); - m_check_box_1 = dynamic_cast(FindSubControl(L"check_new_line")); m_check_box_2 = dynamic_cast(FindSubControl(L"check_time_send")); m_check_box_3 = dynamic_cast(FindSubControl(L"check_hex_send")); m_check_box_4 = dynamic_cast(FindSubControl(L"check_hex_recv")); m_btn_save_lua = dynamic_cast(FindSubControl(L"btn_save_lua")); - m_rich_edit_2->SetRich(true); m_rich_edit_2->SetReturnMsgWantCtrl(true); m_rich_edit_2->SetText(string2wstring(mLuaScript)); - wchar_t p[100] = { 0 }; wsprintf(p, L"ַ%s,˿ں%d δ", string2wstring(m_url).c_str(),m_port); m_label_1->SetText(std::wstring(p)); @@ -73,13 +69,12 @@ void TcpClientForm::Init() if (ev->Type == ui::EventType::kEventClick) { std::wcout << m_uart_send_edit->GetText() << std::endl; auto data = wstring2string(m_uart_send_edit->GetText()); - if (m_check_box_1->IsSelected()) { - data += std::string("\r\n"); - } + data += std::string("\r\n"); this->ClientEvent()->SendDataAsync(data.c_str(), data.size()); } return true; }); + if (nullptr != m_btn_save_lua) { m_btn_save_lua->AttachClick([this](ui::EventArgs*) { std::cout << "luaű\r\n"; diff --git a/examples/proto_debuger/tcp_server_libevent.h b/examples/proto_debuger/tcp_server_libevent.h index 4c5c68fd..a5c85a13 100644 --- a/examples/proto_debuger/tcp_server_libevent.h +++ b/examples/proto_debuger/tcp_server_libevent.h @@ -93,7 +93,6 @@ private: OnAccept m_handle_accept; OnDisconnect m_handle_disconnect; intptr_t mSocketFD; // 操作系统原生socket - }; #endif \ No newline at end of file diff --git a/examples/proto_debuger/udp_client_libevent.cpp b/examples/proto_debuger/udp_client_libevent.cpp new file mode 100644 index 00000000..05398591 --- /dev/null +++ b/examples/proto_debuger/udp_client_libevent.cpp @@ -0,0 +1,8 @@ +#include "udp_client_libevent.h" + +UdpClientLibevent::UdpClientLibevent(std::string ipaddr, uint32_t port) +{ + this->m_bind_ip = ipaddr; + this->m_port = m_port; + +} diff --git a/examples/proto_debuger/udp_client_libevent.h b/examples/proto_debuger/udp_client_libevent.h new file mode 100644 index 00000000..e12fcf40 --- /dev/null +++ b/examples/proto_debuger/udp_client_libevent.h @@ -0,0 +1,36 @@ +#pragma once + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0500 +#include +#endif + +#ifdef linux +#include +#include +#include +#define EVENT__HAVE_PTHREADS +#endif + +#include +#include +#include +#include +#include +#include + +using namespace std; + +class UdpClientLibevent +{ + UdpClientLibevent(std::string ipaddr,uint32_t port); + +private: + uint32_t m_port; // ˿ں + string m_bind_ip; // 󶨶˿ں + int m_current_conection; // ǰĿ + uint16_t m_backlog; + struct sockaddr_in m_server_addr; // ַ + struct event_base* m_event_base; +}; +