没有任何数据可供显示
开源项目社区 | 当前位置 : |
|
www.trustie.net/open_source_projects | 主页 > 开源项目社区 > bear-sock |
bear-sock
|
0 | 0 | 0 |
贡献者 | 讨论 | 代码提交 |
(Sunday, December 06, 2009) The Bear-Sock project has been shutdown for now.This page will be left for reference.
What is Bear-Sock?Bear-Sock is an easy to use open source Winsock wrapper for c++. With simple to use commands, networking with Winsock could never be easyer. Future cross platform capabilitys are also planned for Bear-Sock.
Supported Operating SystemsWindows Note : Linux Operating Systems are being Planned for the Future.
News and UpdatesWednesday, April 1, 2009Bear-Sock has been totally remasterd to work even faster. A server can now be created with ease with only a few lines of code. The error reporting system allows the user to check for an error, and display an error message or close out of the program with their own code.
Sunday, March 29, 2009Development has started on Bear-Sock. Development has also been going very well and faster than I have expected. The current wrapper code is fairly solid, but I will be going over adding and taking out parts of the code. So far, with Bear-Sock, users can start the library, create a working server socket, listen for connections, delete sockets, and finally clean up the library. More development will continue tomarrow.
Important Commands in Bear-SockFirst off, to start using Bear-Sock, you need to define a variable that will hold the library it self.
BearSock Bear;Then to start Bear-Sock, you need to use this statment.
Bear.StartBear();You can also check for errors starting up bear.
if (Bear.StartBear() 1)) // 1 Stands for an Error.
{
Bear.CleanUpBear();
cout << "Could not Start Bear!" << endl;
}As you can see, if an error does occur, you can check for that, display a message, and finally clean up Bear-Sock.
Cleaning up Bear-Sock
Bear.CleanUpBear();Example Usage of Bear-SockIncluding the Bear-Sock LibraryTo include the library for Bear-Sock, you first need to download the header file and place it along side with your project. Then simply use the #include statement to include in the header file into your project.
#include "BearSock.h"Note : Before you compile / build your project, you first need to goto your compiler's compile / build options and add the following linking option.
-lwsock32This will ensure the winsock library is also included in your project.
Starting Bear-Sock#include
#include "BearSock.h"
using namespace std;
int main()
{
BearSock Bear; // Create a Variable for the BearSock Library
if (Bear.StartBear() 1) // BearSock Failed to Start.
{
Bear.CleanUpBear(); // Clean up BearSock.
cout << "Bear Could Not be Started!" << endl;
system("pause");
return 0; // End the Program
}
cout << "Bear has been Started!" << endl; // BearSock Started Correctly!
Bear.CleanUpBear(); // Clean up BearSock.
system("pause");
return 0; // End the Program
}