-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
2,397 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
add_executable(tcpclient src/tcpclient.cpp) | ||
target_link_libraries(tcpclient PUBLIC Poco::Net) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Makefile | ||
# | ||
# Makefile for Poco tcpclient | ||
# | ||
|
||
include $(POCO_BASE)/build/rules/global | ||
|
||
objects = tcpclient | ||
|
||
target = tcpclient | ||
target_version = 1 | ||
target_libs = PocoNet PocoFoundation | ||
|
||
include $(POCO_BASE)/build/rules/exec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// tcpclient.cpp | ||
// | ||
// This sample demonstrates the StreamSocket and SocketStream classes. | ||
// | ||
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | ||
// and Contributors. | ||
// | ||
// SPDX-License-Identifier: BSL-1.0 | ||
// | ||
|
||
|
||
#include "Poco/Net/StreamSocket.h" | ||
#include "Poco/Net/SocketAddress.h" | ||
#include "Poco/Path.h" | ||
#include "Poco/Exception.h" | ||
#include <iostream> | ||
|
||
|
||
using Poco::Net::StreamSocket; | ||
using Poco::Net::SocketAddress; | ||
using Poco::Path; | ||
using Poco::Exception; | ||
|
||
|
||
int main(int argc, char** argv) | ||
{ | ||
if (argc != 3) | ||
{ | ||
Path p(argv[0]); | ||
std::cout << "usage: " << p.getBaseName() << " IP:PORT DATA" << std::endl; | ||
std::cout << " sends DATA to IP:PORT" << std::endl; | ||
return 1; | ||
} | ||
std::string addr(argv[1]); | ||
std::string str(argv[2]); | ||
|
||
try | ||
{ | ||
SocketAddress sa(addr); | ||
StreamSocket sock(sa); | ||
|
||
sock.sendBytes(str.data(), static_cast<int>(str.length())); | ||
} | ||
catch (Exception& exc) | ||
{ | ||
std::cerr << exc.displayText() << std::endl; | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
vc.project.guid = ${vc.project.guidFromName} | ||
vc.project.name = ${vc.project.baseName} | ||
vc.project.target = ${vc.project.name} | ||
vc.project.type = executable | ||
vc.project.pocobase = ..\\..\\.. | ||
vc.project.platforms = Win32 | ||
vc.project.configurations = debug_shared, release_shared, debug_static_mt, release_static_mt, debug_static_md, release_static_md | ||
vc.project.prototype = ${vc.project.name}_vs90.vcproj | ||
vc.project.compiler.include = ..\\..\\..\\Foundation\\include;..\\..\\..\\Net\\include | ||
vc.project.compiler.additionalOptions = /Zc:__cplusplus | ||
vc.project.linker.dependencies.Win32 = ws2_32.lib iphlpapi.lib |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{87c78361-daea-4728-a565-b99fa7bc529a}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\tcpclient.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{ad6a19f8-964e-4e1d-8f8f-54747985384c}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="src\tcpclient.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.