Automated file transfer between two macs using an ethernet cable? - c++

Quick background, I am an intern at a company assigned to a project that I have no experience with, and I need some help trying to figure out where to start.
The goal of the project is to transfer very large chunks of data from a database, to a PC and then to a Mac. I am trying to code the communication between the PC and the Mac (this has to be done in c++, I've heard Python is easier but I have to use c++). Some requirements are that the PC and Mac be directly connected via an ethernet cable, and neither computer will have access to internet. The data transfer needs to be automated, so whenever the PC detects that it has received a full dataset from the database, it transfers the data to the PC. I cannot use any third party software to do this.
So far, through the research I've done, I think I need to set up a TCP Server-Client network. I've been using the code here (http://cs.ecs.baylor.edu/~donahoo/practical/CSockets/practical/) as a guideline for socket coding. I am first trying to test this by sending files between two macs (I don't have access to a PC atm). Any guidelines as to where I go from here would be helpful. I have looked into setting up static IP addresses and such, but I get stuck from there.
I don't expect anyone to code this for me, I am just new to socket coding and this sort of project, so just looking for a nudge in the right direction. Thanks!

Before you start coding, keep in mind that to connect PC to Mac you may need a crossover cable.
Then do some reading on the wired ad-hoc networks. The last post in this discussion may help.
Finally, configure and mount shared volumes (using the stock software, no 3rd parties involved), and don't use the low-level socket interface.

Related

What ways do I have to stream openCV output to my own remote C++ gui?

So I have on one hand an embedded device with a camera running openCV and on the other hand a C++ (Qt) GUI. I would like to connect both i.e.:
"stream" all the output image frames/video from openCV to my remote C++ gui
send commands from my C++ gui to the embedded device
How can I do this, what possibilities do I have? I was thinking about sockets, but I don't know whether that is the easiest solution to stream the image frames from openCV to my Qt gui.
Thank you
You should give us more details about what you're trying to achieve.
You say "stream [...] to my remote C++ GUI": do you mean sending the data over a cabled connection? over a LAN network? over the Internet?
Depending on the answer this changes your system's architecture quite a bit. Especially in case you want to stream the data over the Internet. If your use case implies a LAN network, you can easily setup a peer-to-peer connection between the embedded device and the C++ app to send data. However, it's much more complicated if you want to send data over the Internet, because it is difficult to create a peer-to-peer connection if you don't have static IPs (which I'm assuming you do not have). You will need a server (which can be written with Qt as well) to work as a relay for sending data from the device to your C++ app.
Do you need actual video streaming (at 25fps), or is a low refresh rate (1-0.5fps) sufficient ?
(I'm making the assumption you want to send data over a network)
Because if a low image rate is sufficient, using WebSockets to send images on a regular basis might just do the trick.
Otherwise, you'll need to setup a UDP connection with a video buffer.
Hope this helps!
D

How to detect internet disconnectivity in c++/QT based installer

We are developing win-mac file sync installer which is quite similar to Dropbox. The installer is built with c++ and QT. We had a use case, where if the internet is disconnected(plugged out network cable (or) not connected to any wifi) so basically no access to web, During this case we need to make the installer into offline.
I tried few approaches like polling continuously to our web servers. If we are not able to reach then we detect as internet dis-connectivity. Due to some reasons we wanted to have clean native implementation which will look for machines network connectivity.
I even tried http://msdn.microsoft.com/en-us/library/aa965303%28VS.85%29.aspx for windows but this is failing in wifi cases even though we don't connect to wifi this example is saying "Network connected".
Can anyone suggest other alternatives. Platform specific solutions also invited.
You probably want to look at INetworkManager::GetConnectivity, and check for NLM_CONNECTIVITY_IPV4_INTERNET or NLM_CONNECTIVITY_IPV6_INTERNET in the response.

controlling ethernet speeds in lan c++ windows

I am wondering if it is possible to limit/control ethernet upload and download speeds on specific transport layers (tcp/udp) using c++? I am trying to make a simple to use program that can control the speeds of any device that the ethernet is connected to. For example: Computer B is connected to computer A via Internet Connection Sharing, I use my program to limit computer B's download or upload speed to 120kbs (or any number i choose), with this I would also like to choose udp or tcp.
Basically, I want to create my own program similar to net limiter and other such software, but I also want to add my own features which many of which lack for my needs. These other features are easy enough, but I have no idea how to go about the actual limting process.
The way forward in the general case you ask about would be to create a virtual network adapter and all the monitored route traffic through it. Once that was done, then you can monitor streams between hosts or on specific ports.
Not an easy job... A starting point would be the Windows device driver kit.
If you were prepared to limit just one app, and could modify it, the task would be much simpler... wget and curl for example both offer limiting.
HTH, Ruth

How to incorporate ports / sockets for direct tunneling with p2p darknet app

I'm building an app which upon login will connect you to certain ip addresses of which will also be running the same app.
The method of which i believe i should be using is direct tunnelling but as i say im a little new to c++, i have general coding skills, and i have sifted through a lot of forums and sites yet im still very unclear on what the best way forward is to achieve the requirement.
The reason for the connection will be to enable a secure chat, file transfer, and update software auto when connected to the program admin.
All those that have the app installed will once authorised, will be connected to admin client, then from that client all available ip's to connect to will become available to slave clients, this will increase the network size avilable to all users.
so the app needs to be able to handle ports but not via a server, instead it would be direct.
The connections also must ideally be encrypted.
Im kind of looking for what the application RetroShare does, but in text app.
(This is using C++ within Dev C++)
so just to recap, What method should i use to achieve the above?
I would take a look at SDL net to start with, its really simple to learn if you have never done any socket programming before.
for a secure connection you will probably want to start with TCP and then once you get the hang of network programming, start looking at other protocols.
Hope this helped! and good luck.

Creating C++ client app for some abstract windows server - how to manage TCP connection to server speed?

So we have some server with some address port and ip. we are developing that server so we can implement on it what ever we need for help. What are standard/best practices for data transfer speed management between C++ windows client app and server (C++)?
My main point is in how to get how much data can be uploaded/downloaded from/to client via his low speed network to my relatively super fast server. (I need it for set up of his live stream Audio/Video bit rate)
My try on explaining number 3.
We do not care how fast is our server. It is always faster than needed. We care about client tyring to stream out to our server his media. he streams encoded (via ffmpeg) live video data to our server. But he has say ADSL with 500kb/s of outgoing traffic. Also he uses some ICQ or what so ever so he has less than 500 kb/s per second. And he wants to stream live video! So we need to set up our ffmpeg to encode video with respect to the bit rate user can provide. We develop server side and client side. We need a way of finding out how much user can upload per second currently (so value can change dynamically over time)
Check this CodeProject Article
it's dot-net but you can try figure out the technique from there.
I found what I wanted. "thrulay, network capacity tester" A C++ code library for Available bandwidth tracking in real time on clients. And there is "Spruce" and it is also oss. It is made using some of linux code but I use Boost library so it will be easy to rewrite.
Offtop: I want to report that there is some group of people on SO down voting on all questions on this topic - I do not know why they are so angry but they deffenetly exist.