I have a minor problem where my (new) computer tends to completely freeze up. Am not sure when it happens exactly but the 6 times that it did happen during the last 4 weeks, it could have been related to a very long rendering task that eats up lots of RAM. (Am actually pretty sure that this rendering engine is causing this problem.) Anyway, I don't really care about what causes the problem. I can repeat it by having the same image rendered again and waiting about 4 hours for it to finish. And I can avoid it by making a minor adjustment to the rendered image which somehow seems to solve it all. It's likely a bug in the rendering engine.
And when I say Freeze, I mean that everything stops responding. Keyboard, mouse, disks, they all just stop and the image on my screens are frozen. I don't get a BSOD or automated reboot.
I don't mind the freeze-up, but I would like to receive a warning when the system does freeze up. So I was thinking about a simple solution that should warn me when it does freeze up again. To do so, I want to use an old SmartPhone (HP IPAQ) which runs Windows Mobile 6 and connect it to my computer through one of the USB ports. It would just continue to communicate with my computer to check if it's still alive. When the computer doesn't respond for 5 minutes, it will assume the system is frozen and would have to send a signal to me. Basically, I want it to send me an SMS message to my other phone. Well, consider the SmartPhone to be a kind of lifeguard...
Anyways, I am quite familiar with software development, just don't know where to start with this application. I will be using the .NET Compact Framework and need some pointers in the right direction to do the following:
1) How to connect to a service on another PC using the USB connection and not some wireless Internet connection? (And definitely NOT any Internet over GSM options, since it's just a prepaid card that I'm using for this phone.)
2) How to send an SMS message from this phone to my other phone?
3) Are there already some existing solutions similar to this thing I just came up with, which could save me some time programming?
I used to have an iPaq pocket pc and based on what i remember when you hook them up to the pc they pick up an IP address.
That IP address is the key to your problem,
your computer could ping your pocket pc's ip as a heartbeat. that way you can be sure that you aren't going through GSM since the Desktop is calling the handheld. How to: Create a Socket Listener your socket listener would be listening on your pocket pc if it doesn't get any messages in a set period of time it would trigger the alert winch would send out your SMS.
You could also do the reverse, where your pocket pc would be pinging your desktop, just make sure that you are using the local IP to avoid traffic over GSM
Sending SMS using compact framework
Send SMS Sample
1) You can connect to a USB port as a COM port - many examples on how to do this especially around using GPS. Write an app for your pc to listen to USB for a message and respond. Write the app on the phone to periodically send a message to the PC and get a response.
2) There should be an API for the phone to send an SMS.
3) Not that I know of, the closest being anything that communicates on USB such as I mentioned with GPS-enabled devices.
Good luck - I know (since I have worked with all the technologies you are talking about) that I wouldn't have a problem making this, but for those without that experience it could get tricky.
Related
I have a setup where I have some PLC's connected to a windows PC, I am doing the code on the windows PC in C#. I want to be able to sync the clock of the PLC's with the PC.
The PLC don't support the windows built in time sync services, so I need to do it myself.
My first idea is to just send a message (TCP) to the PLC periodically containing the time of the windows PC. I don't need to be precise on milliseconds, a second would be fine. So my first guess is that this would be enough.
But now I think that if it wasn't so difficult it could be cool to make something that took the time of sending a message on TCP into account to get a more precise sync.
Any ideas on how to achieve that?
Since TCP has some overhead and the amount of data is pretty small, why not use UDP?
Send a UDP request to the server, receive the current time as answer and use half of the answer time as transport delay - rough but easy to do.
I'm trying to write a simple UWP IoT App that is to run on Windows 10 IoT Core on a Raspberry Pi.
The App need to test if another device is currently alive on the local network. All the Apps knows about this other device is its ip address.
I see from other SO questions that Ping is not supporten because ICMP is not supported on WinRT. I assume this also the case on UWP?
I guess I could create a socket and try an connect to for example port 80 and unless a time-out error is received then that means the device is available. However that "hack" seems a bit messy and I'm not sure that it would be solid enough to rely on.
Any other ideas for some C# UWP code that can be used for testing that a device is available and alive on a local network based on its ip address?
You are correct, ICMP is still not supported on UWP. But you could use this instead: https://github.com/christophwille/winrt-vasily (it's kind-of what you wanted to do, but already done)
I've integrated Google Analytics and Flurry into the game I am working (WP8 and MonoGame stack).
It is working perfectly, when the device have a good reception, however it freezes up intermittently if there is no reception (say, when I am in the subway). This deteriorates user experience greatly.
I've also noticed the same behaviour of the phone, if I have a mail to send in the outbox of the standard WP8 email client.
The freezes happen even when I am not submitting data to the GA or Flurry. It seems that GA background retry job kicks in, which is causing freezes.
I wonder if there is acceptable workaround available?
Here what I have found so far:
Seems like GA library supports IsConnected property (source code). If it is offline, it queues up all requests to send them later. However, I don't know which method to use to determine in a non-blocking way if data connection is available.
I have a piece of hardware with an embedded user control accessed by typing the device's IP Address into a web browser. The device is connected directly to my PC via x-over ethernet cable and static IP's. I need to integrate the control of the device into my C# application.
My thought was to use a packet sniffer to monitor the traffic between my PC and the device while at the same time playing with the device's controls in my web browser. Then finding out which packets that my PC is sending correspond with which controls I am using at that time. Then I can create a class of HTTP or TCP packets in my C# application and send them to the device using the Socket class.
However, I dont have much expereince with network protocols, so when I am using Wireshark to monitor the traffic between my PC and the device, I am not sure where to even start when finding out which packets do what. Does anyone have any ideas? I am open to anything. Thanks!!
EDIT:
Its hard to explain exactly what my device is, but its basically an elaborate sensor and typically used in industrial applications, so it could likely be using Modbus, which I am moderately familiar with. Do you know how I can tell which protocol is being used by examining the packets? I noticed (using Wireshark) that the packets being sent from my PC to the device occur in a pattern of 1 HTTP packet, then 5 TCP packets and repeat that same sequence as long as the control is open in my browser. Are there any resources that might give me a better understanding of what is going on?
If this is browser controlled, my first thought would be to examine the web pages the device sends to your browser and see what the browser is instructed to do when you manipulate the controls - this seems much easier than messing around with Wireshark.
Is there something I'm missing that makes this impossible (such as a Flash-based control system)? If it's just done with HTML or Javascript, and HTML POST messages or something a bit more sophisticated like Ajax, it should be relatively easy to work out the interface.
Depending on the device it will either be using a variant of the modbus protocol (http://en.wikipedia.org/wiki/Modbus) or something obscure and propriatory.
The best thing to do is to keep sending the same command to the device over and over again until you can recognise similarities in the packets.
If it is propriatory it will probably be something simple like a command/data pair or possibly an XML blob. If you're really unlucky it will be compressed or encoded but unless you're hacking a game or a cash machine this is unlikely.
Asking the manufacturer of the device if they can give you the spec often works as well.
I am using visual studio 2008 and developing a windows forms application in C# using .net 3.5
I am doing serial communication and on a button click the application getting a list of all the comm ports available. I then scan for the device i am looking for by opening each port in turn, sending my custom handshake request command and waiting the reply for some number of seconds.
It all works fine on my PC (and on other 8 PCs I've tested it on) but when i run the program on a laptop my program seems to see all the comm ports and sends a requires but my device never receives it. I've tried using the hardware comm port and the usb-to-serial converters. I've also tested it on several laptops form different manufacturers. All of the them behave exactly the same.
Has anyone ran into similar problems?
UPDATE 1
The laptops seem to be able to receive data from the device, but still can not transmit. And of course no problems whatsoever with desktops.
UPDATE 2
A laptop can receive and transmit data.
Therefore that narrows the problem down to my C# software that can do serial communication on a desktop but can not do same thing on a laptop.
UPDATE 3
Solved it. The problem was caused by built in modems of my test laptops. The com port reserved by the modem (typically COM3) does not appear in the device manager, but can be seen in the windows regestry. So whenever my serial port object would ask for a list of com ports, it would get the modem port, and these modems choked on my handshake requests during the port scan.
As usual everything is stupid and simple.
Sounds like your device is picky about the voltage levels. RS-232 doesn't nail that down very well, allowing anywhere between +/- 5V to +/- 28V. Most devices are happiest with +/- 12V, a standard voltage available in desktop machines. Laptops however are always on the low end, +/- 5V typ. Not much you can do about it.
To test this theory, eliminate the possibility that this is induced by your code and make sure it works with a null modem. Connect TxD to RxD so that you receive what you send. Then use Hyperterminal or Putty. If the latter fails to see the device as well then it's a hardware problem.