I am currently working on a project involving a BlackWidow board that can establish a connection to the server, but cannot transmit data/receive acknowledgement or anything. For the moment we are trying to send a single byte. There are few examples, and most of them have the BlackWidow acting as a server. The examples where it it acting as a client will not work with us for whatever reason.
What could be the matter and are there some online resources that might help? Any help would be great!
Related
I have a question and I hope someone can help me.
I have a simple TCP chat programmed with Winsock. Unfortunately, it still works only local at the moment. I would like to have it on the Internet, so I can chat with friends just for fun.
Now I have finally come to the point where I have to unlock ports on my router, and I want to avoid that because then my PC plays the server and as soon as it's off, the chat is offline again. I would run it generally in a virtual server, but I'm not sure how, and where I can get the best server for this.
Do I need a Windows server volume, or are there other cool possibilities?
It would be really nice if someone can give me suggestions on how I can implement this best.
I am trying to implement secure communication between a server and client in c++. The limitation is that both the client and server must run on windows and have to be in c++. This is for a research project I am working on at my university.
So far I have found that SChannel is the best option, but the documentation is extremely confusing and I can not find any guides/tutorials on how to use it. I have already looked at this link https://learn.microsoft.com/en-us/windows/desktop/secauthn/creating-a-secure-connection-using-schannel but still do not understand how to get it working. Could someone guide me through this if this is the best way?
I also looked into use SSLStream using the CLR to have .net run inside of a c++ application. However I can not use this because the client application is threaded and threads can't be used with CLR.
I already have a dummy client and server set up with communication between the two, I am just trying to secure and encrypt that communication.
Any help is greatly appreciated!
Whichever SSL library you choose to use there are a few things you need to know as a beginner in this field:
The server and client implementations will end up looking quite different in places.
Your server is absolutely going to need a certificate with a private key. During development you clearly don't want to get one from Verisign or something so you need to create a self-signed certificate. You can do this with openssl or other tools.
The certificate consists of a private part and a public part. The public part needs to go to the client, and will be used to validate the connection. When you are using something like SChannel the certificates (private and public) will need to be installed in the certificate stores of the server and client respectively.
SChannel does not send or receive data for you. So the core of your implementation is going to be: when the network has data: read ciphertext from socket and write to SChannel. Read clear text from SChannel (if any) and pass to application. When the application has data to send, get clear text from Application and pass to SChannel. Get the resulting ciphertext buffers from SChannel and write to the socket.
buffers from the internet may be partial, and negotiations and re-negotiations means there's no 1:1 mapping of passing data into SChannel and getting data out.
You therefore can't get away with a naive implementation that calls SChannel once to pass data in, and once again to get un/encrypted data. There will potentially be nothing available, or a whole lot of packets to send between the client and the server, before you'll get any application bytes. i.e. You will need some kind of state machine to keeptrack of this.
Obviously, don't write both the client and server at the same time: Start with your client against an https server.
That's the general outline of the process - the things that confused me when I first encountered SSL and why none of the samples were nearly as simple as I had hoped them to be.
I have just started using gsoap and after spending a lot of time i have successfully included it in my project and have started to use it. The problem which has been troubling me for past many days is that when i hit a service,it connects over LAN,the connection is established but when i switch over to any wireless network connection doesn't establish,I debugged into the code and found that the connection could not be established over wireless network which results in connection timeout after apt retries.I am unable to figure out why this happens i.e why connection is not established over wireless networks,can anyone guide me as i am a newbie with gSoap and network programming as well. Any help would be appreciated.
I got the SOAP service hit and there was no problem of wired or wireless connection.Basically what I was doing was hitting the service from windows platform(msvc compiler) which was over LAN and then i was trying to integrate the same code with clang compiler to generate a .so to run it on an Android platform. I was getting a proper response when hitting from windows but when hitting from Android I got a TCP error.I could not find any issue in the code when I posted the question and the only difference I could see was connection type of two platforms but there was an underlying issue in integration over android due to which the error was getting generated and I resolved it and now the service is getting hit on both platforms.
GSOAP works like a charm over a network irrespective of the type(wired or wireless) so do not go astray after looking at the question thinking it can be a problem,if u think you have a similar issue,I would recommend looking into other things rather than wasting your time thinking it to be an issue like I did.
Forgive me for the following, as my understanding of winsock is not quite yet complete (I have only started looking in to it over the past two days). For now, my question is brief and more of a "can I do this the way I want to do it?" ordeal. On to the inquiry itself:
A member of my lab has written a nice winsock server that communicates with a client to transmit instructions to various instruments connected via serial. That part is already written and thankfully I do not have to touch; it works universally for all serial devices. However, the existing clients are all written in MatLab, and I'm trying to rewrite them in C/C++.
I've managed to successfully connect to the server and establish a socket. I can receive the data it sends and display it on the client. Great!
The problem I'm having thus far - after all of the initial data (containing instructions) is sent to the client, I cannot do anything. It will display the received data as text, but does not break the simple do while loop I have and ask the user for an input to transmit.
I'm wondering if it possible to set up a receive-then-transmit loop between the server and the client, such that I can send a command and receive the response with one socket in the client until I am done with talking to the server?
I will post my code tomorrow morning once I'm back at my lab computer!
Thank you for your time.
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.