I am new to networking and I am trying to make a basic client and server app.
I would like to know how I can structure my solution in visual studio for this.
What I have now is two projects - one for the client, one for the server. However, both the client and server use code from certain source files that are 'shared' if you would. Common purpose functions, etc.
Since both applications will need this code compiled, do I need to copy these source files in both the client and server project, or is there another, perhaps better way?
Related
Introduction:
I am building a plugin for Firefox version 31.5.0 using the cfx tool. I have been provided with a C++ SDK with header files, .dll files and a .lib file. For this application, I cannot run any scripts or programs on the server, so all code has to work on the client side. Is it possible to integrate this library into my Firefox Plugin (coded mostly in Javascript) such that everything runs on the client side?
Conditions:
I know this isn't the best way to go about developing a web plugin, but it is a requirement I'm faced with. I cannot run anything server side.
Emscripten is a tool I've heard about to convert C++ code to Javascript. For those who have used this tool, are there any deficits in functionality of the code (or even bugs) that arise when converting large libraries to Javascript?
I do not have access to the original source code of the library and thus cannot rewrite it myself in Javascript.
Further Details:
The C++ Library will be used to perform encryption and decryption as well as contact a server for information. Note: The library itself must be executed on the client side.
If C++ isn't viable, I have the option of using JNI to call C++ from a java wrapper application. Is there a way to execute Java code from the client side via the browser?
I apologize for lack of source code. I'm still at the planning stage of this project and I've been tearing my hair out trying to find a solution that fits the criteria.
I am writing a simple service in c++. I have copied the example on
http://www.codeproject.com/Articles/499465/Simple-Windows-Service-in-Cplusplus
verbatim, and everything works fine. Now I needed to add my code for the working thread. I add all of my files to the project, and at this point I still have the exact code from the link, so my project isn't really even using the other cpp/h files I just added. I try to start the service, and boom "cannot start in a timely fashion".
I have tried commenting out of the method definitions of the cpp files I have added, and I've figured out that any method that uses a function from the fastcgi libraries
(found here : http://www.fastcgi.com/drupal/)
causes the service not to start. If I comment out every method uses the fastcgi library, the service will start (but I kind of need those).
Is there any way I can figure out why the use of these libraries are causing the windows service I'm making not to start? (everything works fine as a console application)
Thanks
My project is in Visual Studio Express 2013. I have one Solution for my game called Game. Within the solution I have two Projects one called Client and one called Server. I wrote a Class called Game. I also wrote two more Classes, Client and Server, both inherit from the Game class. I have separate .cpp and .h files for each class. How can I use these files in both projects? I'd like to create a Client object in the client project and a Server object in the server project. Is this possible? Am I going about this the wrong way? I'm trying to use classes more.
On MSDN there is an example in C++ on how to create Dynamic virtual channel plugin.
My problem is that I don't know how to compile it.
Do I need to create an ATL project and in main.cpp copy-and-paste the code found on msdn? What do I call the project? If I create ATL project with name DVCPlugin, than Visual studio 2008 automatically creates DVCPlugin_i.h file, otherwise I don't have that file.
tsvirtualchannels.h is part of Windows 7 SDK so at least with that include I don't have a problem.
One of the errors I am getting is this:
&CLSID_DVCSamplePlugin not recognized identifier
I tried to create ATL project with the name DVCSamplePlugin but I received the same message as above.
Any suggestions I need to do to be able to compile that source code?
It took me a couple of hours, but I got the source for the client plugin to build using VS 2012. Here were my steps.
Start a new ATL Project named DVCPlugin. Select the option for a DLL.
Choose support for COM+ and check the box for the Object Registrar.
Add a file named GUID.cpp to the DVCPlugin project. include stdafx.h in this file.
ATL gave me a class named CompReg, which had its own IDL entries and GUID. I needed to associate that GUID with the CDVCSamplePlugin class.
In DVCPlugin.cpp, add the include for <tsvirtualchannels.h> to the top.
Paste the rest of the sample code after the definition of DllInstall().
Change the line DECLARE_REGISTRY_RESOURCEID(IDR_PLUGIN) to DECLARE_REGISTRY_RESOURCEID(IDR_DVCPLUGIN).
It looks like building the solution silently runs the registry script in the DVCPlugin.rgs file. I had to change the threading model to Free, though.
If mstsc.exe is 64-bit, you need a 64-bit plugin dll for the dynamic discovery to work.
This is just some code for testing Remote desktop connection -
There is an "echo" listener that is implemented by the Remote Desktop Connection (RDC) client, which is always present and listening for incoming connections. When you are writing the server side of a dynamic virtual channel (DVC) module, as a quick test you can open an endpoint named "ECHO". Any write to a channel that is instantiated from this endpoint will result in the receipt of the same data.
From MSDN.
Such projects are usually included in some SDK. And this one seems to be part of Windows 8 SDK
Update: After a critique from Tim (see below), i've decided to add these links with MSDN information -
Remote Desktop Services. TS-Teleport: Sample Instructions and
Remote Desktop Services Blog. Dynamic Virtual Channels
I'm new to COM programming, and creating a basic native COM server / client pair from Visual Studio 2010. Both the client and the server projects live in the same solution. I'd like to know what the most appropriate way is to include the generated client stub and header file in the client project. I've created the MIDL in my server project, and when I compile the project the _h.h, _i.c, and _p.c files are generated in my project source directory.
Do I need to compile both of the .c files in my client project?
Is the best way to compile these in the client project by adding them as linked files in the client project from the source directory of the server project?
Is there a way for Visual Studio to know that the _h.h, _i.c, and _p.c files are out of date when I modify the MIDL, or do I need to remember to recompile the server project any time I touch the MIDL?
Where's the best place for the .h file to go - can it go in the stdafx.h file in the server project? If so, is it proper to add the source directory of the server project to the header include directories of the client project?
Should the client project have a "Reference" (in the Visual Studio Reference sense) to the server project?
Additionally - I'd like to make this registration free. Is there anything extra I need to do in this case, besides having manifests for my client and server?
..
edit
Looking at the MSDN article here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366830(v=vs.85).aspx, it appears that of the files generated, if I only want to support in-proc reg-free activation, I only need to compile the _i.c and include the _h.h files in my client program.
dlldata.c, and _p.c appear to be used to create a proxy DLL, which supports registration on a remote computer (for activation by a remote computer? or also local computer, out of proc? If it's required for local computer, out of proc, why is it needed given that the COM server's dll is registered? The COM server DLL is different from the proxy DLL, yes?)
Thanks very much,
--Matt
The generated _p.c and dlldata.c must be compiled into a separate project to build the proxy/stub DLL. You don't always need one, only when you marshal calls across apartments or processes.
The generated _i.c file provides the GUID values. Compile it into the server and the proxy/stub. Compiling it into the client is okay but using the __uuidof keyword is easiest.
The generated _i.h file contains the interface and coclass declarations. You'll need to #include it in the server and the client.
Midl.exe should automatically regenerate these files when you change the .idl. Which in turn ensures that client, server and proxy/stub get rebuilt.
stdafx.h is fine, yes on the include directory.
No on the "reference", the client and server have no link dependency.
You'll have to write the manifest for reg-free com and embed it in the client.