I have been working on a telnet/SSH app for the Windows Store and the telnet app has been receiving OOB data on its socket but I can't see it inside the app. I know this because the desktop version of the app is receiving OOB data. I also confirmed that the receive buffer in the Windows Store version is missing the one OOB data byte. In Wireshark I have confirmed that the OOB data is being received by the computer so its just not being forwarded to my app. I know in WinSock you need to set a special parameter to receive OOB data inline but I cannot find any such option for a Windows Store app. Does anyone know of a way to get this OOB data?
Another option would be to tell the telnet server to stop sending the OOB data. Is there to tell it to stop sending it?
For reference, the OOB data is being sent when pressing Ctrl+C. The OOB data byte is 0xFF and is the first byte sent by the server.
Thanks.
It appears that this functionality is not implemented in WinRT. Marking as answered.
http://social.msdn.microsoft.com/Forums/en-US/05a26a4b-e0db-4fed-b5d0-b67a2d9e2b1c/out-of-band-data-using-windowsnetworkingsockets?forum=winappswithnativecode
Related
Concept
we have a ship simulator(client) and Modbus controller(Server). Our goal is to develop an emulator(like controller) on my PC. But we have no information about the client(simulator).
Progress
Firstly we checked the actual outputs from the controller(server). There are 7 different variables like engine telegraph, rudder angle and so no.
Secondly, I checked the register numbers of the controller, which store command values. It was from 0 to 7.
Polling server with Modpoll software installed server:
I checked the register type. It was a holding register
I wrote a script to develop a Server like a controller with pymodbus Server. I can not only write specific values on the holding register from 0 to 7, but also there are proper handshake and responses to the simulator(client)
Problem
Client sends a request for reading with register numbers from 256. It means that my Server responds with zero values not with the command values written on the registers from 0 to 7. But the problem is that the simulator(client) shows the changes of the parameters on its Graphical user interface.
Screen shot from wireshark - it shows that clinet(simulator) sends a request with register nuumber from 246:
Client sends a request not only for reading but also for writing and the writing request overwrite the values written by Server (PC).
Question
how is it possible that the simulator receives the command signal by requesting different register numbers? client must send a request with register numbers from 0 to receive command signals.
I cannot understand why the client writes first before reading values from Server. This read request overwrites the values written by Server (pc). The Server (controller or pc) is to send a command signal to the simulator. I have no idea why the simulator first writes some values on sever and read it.
Please advise on this issue.
Best regards
Byeon seongsu.
This question is not for a concrete implementation of how this is done. It is more about the concept and design of sending information over Internet with some kind of protocol - either TCP or UDP. I know only that sockets are needed, but I am wondering about the rest. For example after a connection is made and you send the information through that, but how does the other end listen for a specific port and does it listen constantly?
Is listening done in a background thread waiting for information to be received? (In order to be able to do other things/processing while waiting for information)
So in essence, I think a real world example of how such an application works on a high level would be enough to explain the data flow. For example sending files in Skype or something similar.
P.S. Most other questions on similar topics are about a concrete implementation or a bug that someone has.
What I currently do in an application is the following using POSIX sockets with the TCP Protocol:
Most important thing is: The most function are blocking functions. So when you tell your server to wait for client connection, the function will block until a connection is established (if you need a server that handles multiple clients at once, you need to use threading!)
Server listens for specific port until a client connects. After the connect, you will get a new socket file descriptor to communicate with the client whilst the initial socket can listen to new connections. My server then creats a new thread to handle that client whilst waiting for new connections on the initial socket. In the new thread the server waits for a request command from the Client (e.g. Request Login Token). After a request was received by the server, the server will gather its informations, packs it together using Googles Protocol Buffers and sends it to the client. The client now either tells the server to terminate the session (if every data is received by the client that it needs) or send another request.
Thats basically the idea in my server. The bigger problem is the way you transmit and receive data. E.g. you cant send structs or classes (at least not via C++) over the wire, you need some kind of serializer and you have to make sure the other part knows how much to receive. So what i do is, first send a 4byte integer over the wire containing the size of the incomming package, then send the package itself using a serializer (in my case Googles Protocol buffers). The other side waits for 4 byte to be available, knowing that this will be the size of the incomming package. After 4 bytes are received, the program waits for exact that amount of data being available on the socket, when available, read the data out of the buffer and deserialize it. When the socket is not receiving data for 30 seconds, trigger a timeout and terminate the connection.
What you always need to be aware of is the endianess of the systems. E.g. a big endian system (e.g. PowerPC) and a little endian system (e.g. x86) will have problems when you send an integer directly over the wire. For example a
0001
on the x86, is a
1000
on the Power PC, thus making a 8 out of a 1. So you should always use functions like ntohl, an htonl, which will convert data from and to host byte order from and to network byte order (network byte order is always big endian).
Hope this kind of helps. I could also provide some code to you if that would help.
I want to capture and save the data that's being sent to a certain process through internet .
Are there any tools for the job?
If not, does listening to the same port as the process that I'm trying to get data from, will get me the data?
Any help appreciated !
You can try Wireshark: http://www.wireshark.org/
Or RawCap: http://www.netresec.com/?page=RawCap
I don't know what is the data format you are trying to capture. I used these two tools to capture xml data from web service.
On Windows, use Winsock Packet Editor (WPE). You will be able to hook a process' all Winsock-related functions and capture (and even modify/block) any TCP/IP, UDP packets that the application receives or sends. For all other operating systems, you will have to either:
write your own tool that hooks various socket functions (e.g. send, recv, etc.)
or just use Wireshark which will capture all Layer-3 packets that goes through your network card. You will have to use your own knowledge of the application that you're trying to monitor in order to filter the packets that are specific to the application.
Are there any tools for the job?
Wireshark. But what have you tried?
If not, does listening to the same port as the process that i'm trying to get data from, will get me the data?
Not if you don't forward the traffic to the real destination, otherwise the other party will be waiting forever on a response, or simply timeout and close the connection. You should create something like a proxy.
Wireshark is easier.
i have created a metro style datagram server and a client using Windows.Networking.Sockets. i am doing code in c++
Than i tried to connect and send data from client to server.
but the problem i am facing is that,
as windows metro application is totally asynchronous,my app starts to send data before connection being completed.
i want an approach through which my send function will send data after the connection completed.
msdn has provided a sample code for client server but they use a button to send data which takes time to operate meanwhile the connection is completed.Thats why the application runs well.
but i am trying to do client server communication in the main code without using send Button.
Making some assumptions here b/c you didn't provide any code, but you should use the continuation of your DatagramSocket.ConnectAsync create_task. If you put the send data in the task::then, you will not have a problem with the async nature of the call. See this article on dealing with async in C++ Windows 8 apps. Lots of great examples here as well.
How can i connect a windows phone 7 device with a WiFi-enabled micro controller. Should i use socket programming?? If yes then how?? I actually want to send a text file or a text message to the micro controller using WI-FI??
Your question is a bit vague. Are you trying to write a app that enables you to send a text file/message?
or are you trying to accomplish this by connecting to the microcontroller with the default connection your phone provides.
If you want to write your own app, you can do this by using a windows socket function. Have you looked into the standard code examples windows provides? They provide good examples about the basis of windows phone wifi connectivity
in example:
Example 1
Example 2
Edit:
You should take a look at this example.
Example
In this microsoft example, they make the game tic tac too between two windows phones. For your cause, you can read the data form file. Temporarly store it in an array. And send it over wifi. if you customize the example to fit your needs, so in steps:
Declare a socket (with the right ip adresses, ports etc)
Read file
Store in array
Send array by the wifi (using your previously declared socket)
And then on the microcontroller, you need some way to filter your data out of the incomming wifi buffer. I looked into one of my older projects where i did something like this. But i couldn't find it anymore. So i must have deleted it at some point "sorry :( " i you can work this out using the example