diff --git a/Client/Client.vcxproj b/Client/Client.vcxproj
index bf7a42a..50f8d7b 100644
--- a/Client/Client.vcxproj
+++ b/Client/Client.vcxproj
@@ -100,7 +100,7 @@
Console
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -114,7 +114,7 @@
Console
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -132,7 +132,7 @@
true
true
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -150,7 +150,7 @@
true
true
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
diff --git a/Client/Debug/Client.log b/Client/Debug/Client.log
index a66f366..4bcbbc6 100644
--- a/Client/Debug/Client.log
+++ b/Client/Debug/Client.log
@@ -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
diff --git a/Client/Debug/Client.tlog/CL.read.1.tlog b/Client/Debug/Client.tlog/CL.read.1.tlog
index cc174e0..0908888 100644
Binary files a/Client/Debug/Client.tlog/CL.read.1.tlog and b/Client/Debug/Client.tlog/CL.read.1.tlog differ
diff --git a/Client/Debug/Client.tlog/link.command.1.tlog b/Client/Debug/Client.tlog/link.command.1.tlog
index 70c2370..f046d33 100644
Binary files a/Client/Debug/Client.tlog/link.command.1.tlog and b/Client/Debug/Client.tlog/link.command.1.tlog differ
diff --git a/Client/Debug/Client.tlog/link.read.1.tlog b/Client/Debug/Client.tlog/link.read.1.tlog
index 6b1bda0..bdf266c 100644
Binary files a/Client/Debug/Client.tlog/link.read.1.tlog and b/Client/Debug/Client.tlog/link.read.1.tlog differ
diff --git a/Client/Debug/Client.tlog/link.write.1.tlog b/Client/Debug/Client.tlog/link.write.1.tlog
index b49fa63..323d114 100644
Binary files a/Client/Debug/Client.tlog/link.write.1.tlog and b/Client/Debug/Client.tlog/link.write.1.tlog differ
diff --git a/Client/Debug/vc142.idb b/Client/Debug/vc142.idb
index 7c40eeb..693ee12 100644
Binary files a/Client/Debug/vc142.idb and b/Client/Debug/vc142.idb differ
diff --git a/Client/Debug/vc142.pdb b/Client/Debug/vc142.pdb
index ec2b585..5effba5 100644
Binary files a/Client/Debug/vc142.pdb and b/Client/Debug/vc142.pdb differ
diff --git a/Client/client.cpp b/Client/client.cpp
index 1844ac7..6fd031f 100644
--- a/Client/client.cpp
+++ b/Client/client.cpp
@@ -1,9 +1,17 @@
//Client
#include
+using namespace SocketLibrary;
+
int main()
{
- int value = SocketLibrary::ReturnFive();
+ if (Network::Initialize() == true)
+ {
+ Log::Print("[CLIENT] Winsok zostal zainicjolizowany. Mozemy dzialac.");
+ }
+
+
+ Network::Shutdown();
return 0;
}
@@ -11,4 +19,5 @@ int main()
//(VC++ Directories) Add Include Dir -> Solution Dir
//(VC++ Directories) Add Library Dir -> Output Dir
//(Linket/Input) Add Additional Dep -> SocketLibrary.lib
-//(Solution/Project Build Order/Dependecies) Correct Oreder Build
\ No newline at end of file
+//(Solution/Project Build Order/Dependecies) Correct Oreder Build
+//(Linker/Input) Add Additional Dep -> ws2_32.lib
\ No newline at end of file
diff --git a/Debug/Client.exe b/Debug/Client.exe
index 184b843..7a584a2 100644
Binary files a/Debug/Client.exe and b/Debug/Client.exe differ
diff --git a/Debug/Client.ilk b/Debug/Client.ilk
index 1c62122..62ceda1 100644
Binary files a/Debug/Client.ilk and b/Debug/Client.ilk differ
diff --git a/Debug/Client.pdb b/Debug/Client.pdb
index 984934b..fb72a30 100644
Binary files a/Debug/Client.pdb and b/Debug/Client.pdb differ
diff --git a/Debug/Server.exe b/Debug/Server.exe
index 91b5348..eab83b9 100644
Binary files a/Debug/Server.exe and b/Debug/Server.exe differ
diff --git a/Debug/Server.ilk b/Debug/Server.ilk
index d91cd33..d4a836f 100644
Binary files a/Debug/Server.ilk and b/Debug/Server.ilk differ
diff --git a/Debug/Server.pdb b/Debug/Server.pdb
index 818da50..37922ea 100644
Binary files a/Debug/Server.pdb and b/Debug/Server.pdb differ
diff --git a/Debug/SocketLibrary.lib b/Debug/SocketLibrary.lib
index 2a969ec..7722257 100644
Binary files a/Debug/SocketLibrary.lib and b/Debug/SocketLibrary.lib differ
diff --git a/Debug/SocketLibrary.pdb b/Debug/SocketLibrary.pdb
index 02ff430..6cb42c2 100644
Binary files a/Debug/SocketLibrary.pdb and b/Debug/SocketLibrary.pdb differ
diff --git a/Server/Debug/Server.Build.CppClean.log b/Server/Debug/Server.Build.CppClean.log
index 11f0f2f..3cbb486 100644
--- a/Server/Debug/Server.Build.CppClean.log
+++ b/Server/Debug/Server.Build.CppClean.log
@@ -1,6 +1,6 @@
c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\server\debug\vc142.pdb
c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\server\debug\vc142.idb
-c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\server\debug\source.obj
+c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\server\debug\server.obj
c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\debug\server.ilk
c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\debug\server.exe
c:\users\bartool\mydata\mycode\cpp\visualstudio_lap\lanchat\debug\server.pdb
diff --git a/Server/Debug/Server.log b/Server/Debug/Server.log
index c379fdc..1a7fc6b 100644
--- a/Server/Debug/Server.log
+++ b/Server/Debug/Server.log
@@ -1,2 +1,2 @@
- Source.cpp
+ server.cpp
Server.vcxproj -> C:\Users\bartool\MyData\MyCode\Cpp\VisualStudio_lap\LanChat\Debug\Server.exe
diff --git a/Server/Debug/Server.tlog/CL.command.1.tlog b/Server/Debug/Server.tlog/CL.command.1.tlog
index 5e6d448..4c35da0 100644
Binary files a/Server/Debug/Server.tlog/CL.command.1.tlog and b/Server/Debug/Server.tlog/CL.command.1.tlog differ
diff --git a/Server/Debug/Server.tlog/CL.read.1.tlog b/Server/Debug/Server.tlog/CL.read.1.tlog
index 5be5b16..9b380da 100644
Binary files a/Server/Debug/Server.tlog/CL.read.1.tlog and b/Server/Debug/Server.tlog/CL.read.1.tlog differ
diff --git a/Server/Debug/Server.tlog/CL.write.1.tlog b/Server/Debug/Server.tlog/CL.write.1.tlog
index c38a3ba..db76f63 100644
Binary files a/Server/Debug/Server.tlog/CL.write.1.tlog and b/Server/Debug/Server.tlog/CL.write.1.tlog differ
diff --git a/Server/Debug/Server.tlog/link.command.1.tlog b/Server/Debug/Server.tlog/link.command.1.tlog
index 06d5a6f..27199b5 100644
Binary files a/Server/Debug/Server.tlog/link.command.1.tlog and b/Server/Debug/Server.tlog/link.command.1.tlog differ
diff --git a/Server/Debug/Server.tlog/link.read.1.tlog b/Server/Debug/Server.tlog/link.read.1.tlog
index aca3f42..b6e4b48 100644
Binary files a/Server/Debug/Server.tlog/link.read.1.tlog and b/Server/Debug/Server.tlog/link.read.1.tlog differ
diff --git a/Server/Debug/Server.tlog/link.write.1.tlog b/Server/Debug/Server.tlog/link.write.1.tlog
index 217ad9b..d91b346 100644
Binary files a/Server/Debug/Server.tlog/link.write.1.tlog and b/Server/Debug/Server.tlog/link.write.1.tlog differ
diff --git a/Server/Debug/Source.obj b/Server/Debug/Source.obj
deleted file mode 100644
index bb9fe22..0000000
Binary files a/Server/Debug/Source.obj and /dev/null differ
diff --git a/Server/Debug/vc142.idb b/Server/Debug/vc142.idb
index 84689d7..33d6396 100644
Binary files a/Server/Debug/vc142.idb and b/Server/Debug/vc142.idb differ
diff --git a/Server/Debug/vc142.pdb b/Server/Debug/vc142.pdb
index e35be41..d2ef054 100644
Binary files a/Server/Debug/vc142.pdb and b/Server/Debug/vc142.pdb differ
diff --git a/Server/Server.vcxproj b/Server/Server.vcxproj
index 8d50926..7d4195b 100644
--- a/Server/Server.vcxproj
+++ b/Server/Server.vcxproj
@@ -100,7 +100,7 @@
Console
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -114,7 +114,7 @@
Console
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -132,7 +132,7 @@
true
true
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
@@ -150,11 +150,11 @@
true
true
true
- SocketLibrary.lib;%(AdditionalDependencies)
+ ws2_32.lib;SocketLibrary.lib;%(AdditionalDependencies)
-
+
diff --git a/Server/Server.vcxproj.filters b/Server/Server.vcxproj.filters
index 41d453a..c7c4a47 100644
--- a/Server/Server.vcxproj.filters
+++ b/Server/Server.vcxproj.filters
@@ -15,7 +15,7 @@
-
+
Source Files
diff --git a/Server/Source.cpp b/Server/Source.cpp
deleted file mode 100644
index 7c8bcb9..0000000
--- a/Server/Source.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-//Server
-#include
-int main()
-{
- int value = SocketLibrary::ReturnFive();
- return 0;
-}
\ No newline at end of file
diff --git a/Server/server.cpp b/Server/server.cpp
new file mode 100644
index 0000000..f09e4cb
--- /dev/null
+++ b/Server/server.cpp
@@ -0,0 +1,22 @@
+//Server
+#include
+
+using namespace SocketLibrary;
+
+int main()
+{
+ if (Network::Initialize() == true)
+ {
+ Log::Print("[SERVER] Winsok zostal zainicjolizowany. Mozemy dzialac.");
+ }
+
+
+ Network::Shutdown();
+ return 0;
+}
+
+//(VC++ Directories) Add Include Dir -> Solution Dir
+//(VC++ Directories) Add Library Dir -> Output Dir
+//(Linket/Input) Add Additional Dep -> SocketLibrary.lib
+//(Solution/Project Build Order/Dependecies) Correct Oreder Build
+//(Linker/Input) Add Additional Dep -> ws2_32.lib
\ No newline at end of file
diff --git a/SocketLibrary/Debug/SocketLibrary.idb b/SocketLibrary/Debug/SocketLibrary.idb
index a35b3d2..74bd212 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.idb and b/SocketLibrary/Debug/SocketLibrary.idb differ
diff --git a/SocketLibrary/Debug/SocketLibrary.log b/SocketLibrary/Debug/SocketLibrary.log
index 949faa5..ca229b0 100644
--- a/SocketLibrary/Debug/SocketLibrary.log
+++ b/SocketLibrary/Debug/SocketLibrary.log
@@ -1,2 +1,2 @@
- server.cpp
+ Network.cpp
SocketLibrary.vcxproj -> C:\Users\bartool\MyData\MyCode\Cpp\VisualStudio_lap\LanChat\Debug\SocketLibrary.lib
diff --git a/SocketLibrary/Debug/SocketLibrary.pdb b/SocketLibrary/Debug/SocketLibrary.pdb
index 02ff430..6cb42c2 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.pdb and b/SocketLibrary/Debug/SocketLibrary.pdb differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/CL.command.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/CL.command.1.tlog
index 854c271..dd5358f 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/CL.command.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/CL.command.1.tlog differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/CL.read.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/CL.read.1.tlog
index a460dd6..34177fb 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/CL.read.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/CL.read.1.tlog differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/CL.write.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/CL.write.1.tlog
index 355512c..ab19db7 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/CL.write.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/CL.write.1.tlog differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.read.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.read.1.tlog
index ece6522..4a51eb5 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.read.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.read.1.tlog differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.write.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.write.1.tlog
index 42bab3e..b1b3eb6 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.write.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/Lib-link.write.1.tlog differ
diff --git a/SocketLibrary/Debug/SocketLibrary.tlog/Lib.command.1.tlog b/SocketLibrary/Debug/SocketLibrary.tlog/Lib.command.1.tlog
index 26a6a4e..e3ad30e 100644
Binary files a/SocketLibrary/Debug/SocketLibrary.tlog/Lib.command.1.tlog and b/SocketLibrary/Debug/SocketLibrary.tlog/Lib.command.1.tlog differ
diff --git a/SocketLibrary/Log.cpp b/SocketLibrary/Log.cpp
new file mode 100644
index 0000000..a769493
--- /dev/null
+++ b/SocketLibrary/Log.cpp
@@ -0,0 +1,12 @@
+#include
+#include "Log.h"
+
+void SocketLibrary::Log::Print(std::string message)
+{
+ std::cout << message << std::endl;
+}
+
+void SocketLibrary::Log::PrintError(std::string message, int error)
+{
+ std::cerr << "[Error Code: " << error << "] "<< message << std::endl;
+}
diff --git a/SocketLibrary/Log.h b/SocketLibrary/Log.h
new file mode 100644
index 0000000..21e66f8
--- /dev/null
+++ b/SocketLibrary/Log.h
@@ -0,0 +1,12 @@
+#pragma once
+#include
+
+namespace SocketLibrary
+{
+ class Log
+ {
+ public:
+ void static Print(std::string message);
+ void static PrintError(std::string message, int error);
+ };
+}
\ No newline at end of file
diff --git a/SocketLibrary/Network.cpp b/SocketLibrary/Network.cpp
new file mode 100644
index 0000000..3b7328b
--- /dev/null
+++ b/SocketLibrary/Network.cpp
@@ -0,0 +1,37 @@
+#include
+
+#include "Network.h"
+#include "Log.h"
+
+bool SocketLibrary::Network::Initialize()
+{
+ WSADATA wsadata;
+
+ int result = WSAStartup(MAKEWORD(2,2), &wsadata);
+ if (result != 0)
+ {
+ Log::PrintError("Nie udalo sie uruchomic Winsock", result);
+ return false;
+ }
+ else
+ {
+ Log::Print("Winsock zostal uruchominy");
+ }
+
+ if (LOBYTE(wsadata.wVersion) != 2 || HIBYTE(wsadata.wVersion) != 2)
+ {
+ Log::PrintError("Nie udalo sie uruchomic WinSock w najwyzszej wersji.", result);
+ return false;
+ }
+ else
+ {
+ Log::Print("Udalo sie uchomic WinSock w wersji 2,2.");
+ }
+
+ return true;
+}
+
+void SocketLibrary::Network::Shutdown()
+{
+ WSACleanup();
+}
diff --git a/SocketLibrary/Network.h b/SocketLibrary/Network.h
new file mode 100644
index 0000000..049da3c
--- /dev/null
+++ b/SocketLibrary/Network.h
@@ -0,0 +1,14 @@
+#pragma once
+#define WIN32_LEAN_AND_MEAN
+
+//#include
+
+namespace SocketLibrary
+{
+ class Network
+ {
+ public:
+ static bool Initialize();
+ static void Shutdown();
+ };
+}
\ No newline at end of file
diff --git a/SocketLibrary/SocketLibrary.h b/SocketLibrary/SocketLibrary.h
index bf42875..3ee2f67 100644
--- a/SocketLibrary/SocketLibrary.h
+++ b/SocketLibrary/SocketLibrary.h
@@ -1,7 +1,3 @@
#pragma once
-
-
-namespace SocketLibrary
-{
- int ReturnFive();
-}
\ No newline at end of file
+#include "Network.h"
+#include "Log.h"
\ No newline at end of file
diff --git a/SocketLibrary/SocketLibrary.vcxproj b/SocketLibrary/SocketLibrary.vcxproj
index 7d1dae9..42d24af 100644
--- a/SocketLibrary/SocketLibrary.vcxproj
+++ b/SocketLibrary/SocketLibrary.vcxproj
@@ -142,10 +142,13 @@
+
+
-
+
+
diff --git a/SocketLibrary/SocketLibrary.vcxproj.filters b/SocketLibrary/SocketLibrary.vcxproj.filters
index 13a3a49..13fce30 100644
--- a/SocketLibrary/SocketLibrary.vcxproj.filters
+++ b/SocketLibrary/SocketLibrary.vcxproj.filters
@@ -18,9 +18,18 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
-
+
+ Source Files
+
+
Source Files
diff --git a/SocketLibrary/server.cpp b/SocketLibrary/server.cpp
deleted file mode 100644
index cb8f5d1..0000000
--- a/SocketLibrary/server.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "SocketLibrary.h"
-
-namespace SocketLibrary
-{
- int ReturnFive()
- {
- return 5;
- }
-}
\ No newline at end of file