I need to send logs to syslog server using cpp. Syslog server maybe configured on same machine or different machine in the network. Syslog server maybe present on windows or linux machine. Is there any third party library which I can use to forward logs to the syslog server ? Cpp will be preferred option for me to code. If third party library is not present what will be better option ?
you can use the syslog.conf file, instead of the sy
Related
so I have a folder "Assets" which is in the same folder with my server executable. I want to return file from it (ofcource if file exists) to any user that connects to my server via tcp and sends a filename (generally I wish to see a asinc, nonblocking tcp server made using boost which would simply return any file form folder near to the executable). How to do such thuing with boost? (I use VS 2010 for compiling)
This sounds like a job for a web server. This is what web servers do. They are good at it.
Consider using one of the zillion web server apps out there or integrate a little web server into your program:
- https://github.com/cloudmeter/pion
There are more linked from this question:
- https://stackoverflow.com/questions/175507/c-c-web-server-library
My application runs in Windows and is implemented using C++/Qt.
The application will invoke another application deployed in the Linux server which in turn will invoke some third party tools. The Linux server application will send some status updates based on the running of third party tools. Usually the third party application will run for hours and the updates will be sent at various stages. The Linux server may also has to send some files in addition to the status updates and the Windows client will also send some files required for the running of those third party tools.
I planned to implement this in libssh2 since file transfers can be done and applications can be executed as well using libssh2_channel_exec(). Updates can be sent and received through non-blocking socket transfers. Also the transfers must be secured and they are password authenticated, so I thought SSH will conform my requirements.
I also looked into Qpid of apache which implements the AMQP. The messaging seems to be a more appropriate one for my status updates since the updates are less frequent. But I am not so sure about the secured connection, password authentication and also the application invocation.
So, which one can I choose between these two? Or is there any other better option available? I am not quite used to network programming so any pointers, links regarding this are welcome..
Have you considered some web-based solutions like XML-RPC, REST, SOAP or other? Note that you can either have constant network connection and stream updates or just make your client ask for update as often as it needs.
Also, I think that building solution based on some of these protocols will give you easier coding - no need for some low-level solutions when you have great libraries. As for security part, I would consider SSL that is part of HTTPS protocol to be secure enough. Of course you can also do it hybrid style, for example SSH tunel to secure server and use SSH key authorization.
But if you are sure youwant SSH or AMQP then use first one - I think it has better security. Also, try not using username/passowrd. Instead use mentioned above keys.
Start with SSH, and then consider layering other protocols on top. You can use SSH port forwarding to create a VPN connection to a server, and maybe that will make it easier to use something like AMQP or 0MQ.
Is there any way in C++ on windows to monitor a program and redirect any outgoing requests it makes on a specific port? I have a simple C++ http proxy and want it to be able to automatically redirect all browser requests on port 80 through itself.
The simple way to do it is to create a Windows kernel hook to trap socket requests and reroute them to your proxy.
Some useful documentation on this is:
http://www.internals.com/articles/apispy/apispy.htm
If you're using Windows Vista or better, consider Windows Filtering Platform (WFP):
http://www.microsoft.com/whdc/device/network/wfp.mspx
Also consider looking at Detours (commercial) and EasyHook (free). They significantly simplify the process of writing hooks and redirecting API calls (both Win32 and Application).
The program would have to be run with administrative privileges in kernel mode of the host OS.
While I don't have extensive experience with windows kernel hooks, in BSD and linux its trivial to install a kernel module that over-writes the system calls for creating sockets and could easily redirect all sockets to a proxy socket of choice.
If you mean [any destination port] to [one port] then you will have to rely on special drivers. The problem with windows is the inability to natively block [drop] packets. For example a common solution is winpcap. However, while you can monitor traffic, you cannot stop the traffic or modify it in a useful way.
On windows the only solution I've seen would be to use some open TUN/TAP adapter. With that, you would be able to modify every packet that leaves your system.
If you know beforehand the destination port you will be using then it gets rather simple. Simply write a passthrough c++ socket program that will only change the destination port.
If you want to redirect browser requests then you can simply edit the settings in your browser.
On linux platform, I want to have dhcp client.
port any open source client to my app (which seems to be a bit time consuming)?
or communicate with the standalone client app via Signals?
or anyone knows any dhcp client library?
thanks for any advice.
You mean you want your app to tell the computer to DHCP? I would talk to dhcpcd using command line arguments and not do tons of extra work.
I need to write a basic RDP client in C/C++, doesn't need GUI it can be CLI, it only needs to connect to specified hosts - if connection is successfull, to confirm it and if it isn't to output an error message like the pass is not correct.
Can someone point me to somewhere so i can read more about this ? Thanks.
Look at the source for rdesktop - A Remote Desktop Protocol Client for accessing Windows Terminal Services.
For a quick feel, view the source for tcp.c: Protocol services - TCP layer.
You're probably looking for the Windows Terminal Services API or also known as the Remote Desktop Services API.