I am working on a project and I need to create an API. I use sockets to communicate between the server (my application) and clients (other applications using my API).
This project is in c not C ++
I come from a linux background, and this is my first project using the Windows libraries, Visual Studio 2008 and the DLL.
I have a connection between client and server, but I have some that are duplicated in both projects. I would like to create a library (possibly a dll file) that both projects can reference, so I don't need to support additional code.
I also need to create a library that has an API that I need to make available to my clients. The API functions that I want to publish have calls to these helper functions, which are “duplicated code,” I don’t want to expose these functions to my client, but I want my server to be able to use these functions. How can i do this?
I will try to clarify an example. This is where I started.
Server project:
int Server_GetPacket(SOCKET sd);
int ReceiveAll(SOCKET sd, char *buf, int len);
int VerifyLen(char *buf);
Client project:
int Client_SendCommand(int command);
int Client_GetData(int command, char *buf, int len);
int ReceiveAll(SOCKET sd, char *buf, int len);
int VerifyLen(char *buf);
Here is what I would like to receive:
int Server_GetPacket(SOCKET sd);
int ReceiveAll(SOCKET sd, char *buf, int len);
int VerifyLen(char *buf);
int Client_SendCommand(int command);
int Client_GetData(int command, char *buf, int len);
Thanks for any help would be appreciated.