[working] wysyla i odbiera dane
This commit is contained in:
@@ -1,2 +1 @@
|
||||
client.cpp
|
||||
Client.vcxproj -> C:\Users\bartool\MyData\MyCode\Cpp\VisualStudio_lap\LanChat\Debug\Client.exe
|
||||
Client.vcxproj -> C:\Users\bartool\MyData\MyCode\Cpp\VisualStudio_lap\LanChat\Debug\Client.exe
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
//Client
|
||||
#include <SocketLibrary/SocketLibrary.h>
|
||||
//#include <string>
|
||||
#include <iostream>
|
||||
|
||||
using namespace SocketLibrary;
|
||||
|
||||
@@ -8,10 +10,33 @@ int main()
|
||||
if (Network::Initialize() == true)
|
||||
{
|
||||
Log::Print("[CLIENT] Winsok zostal zainicjolizowany. Mozemy dzialac.");
|
||||
Socket socket;
|
||||
if (socket.Create() == Result::Success)
|
||||
{
|
||||
Log::Print("[CLIENT] Utworzylem socket.");
|
||||
if (socket.Connect(Endpoint("127.0.0.1", 54000)) == Result::Success)
|
||||
{
|
||||
Log::Print("[CLIENT] Polaczylem sie serverem.");
|
||||
std::string outString = "Wysylam z klienta.";
|
||||
char buffer[256];
|
||||
strcpy_s(buffer, "witam z klienta!\0");
|
||||
|
||||
while (true)
|
||||
{
|
||||
socket.SendAll(outString.data(), outString.size());
|
||||
//socket.SendAll(buffer, 256);
|
||||
std::cout << "wyslalem 256 bajtow" << std::endl;
|
||||
Sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
socket.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Network::Shutdown();
|
||||
system("pause");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user