Implementing phone communication with my C# application - c#

I want to have the app i am creating to communicate with my personal android device. As in, my application will be monitoring something on my server, and when something changes it needs to somehow send an option to act or ignore to my phone, and my personal reply (Yes/No) should be send back to the server.
I don't mind any specific protocols. Anything which does not require an app running actively on my phone would be nice, but i am not that great with android native development so if it can be done it should be relatively simply to achieve.
My own idea would be to actually implement Email somehow. So my phone could get an email on my google account (which in turn creates a notification), to which i would send a reply email with my reply. Which in turn will be read out on my server.
The bad part is that i would have to actually open gmail and type out a short message to send back as a reply. So anything easier then that would be a great thing.
I have seen newer android 6 apps use custom buttons in notifications in order for the app to act on, but i have no clue how hard those are to implement and rig to my reply.
Please note that this application is probably nothing that will go public. So i am not going to bother to worry about load or efficiency in the end of it. Since it will be just me and my server.
Any input would be greatly appreciated. The most convenient/easy-to-use method will be marked as the answer.

I think...u can use xml-rpc " http://xmlrpc.scripting.com " for communicating with your server and android app.
I used it in my personal project and found iI to be useful.In my case,I used wordpress as framework so any new updates in my server is notified by this protocol.

Related

Masking IP on the Windows Phone

I am attempting to provide some anonymity to my users on the Windows Phone when they post data to my server.
Without going into to much detail, the only thing that ties the user to the data in my database is the ip they call into my server from. I would like to mask this.
I have looked into creating a WebProxy object but apparently this isn't available in the Windows Phone .NET framework.
I am considering just informing the user of their exposure and making it easy for them to setup a VPN on their device.
Is there another way I can mask their IP when they call into my server? The more automated I can make it for them the better.
You can't mask it entirely inside your app becuase the network connection won't work, but you can maybe use third party services like Hola

Communicating to Windows Mobile using C#.net over TCP/IP or HTTP?

We are building an application which is suppose to connect to the Support Engineer's Mobile phone and will alert him about any job to be done.
This application will be based on 2 parts. one is Control Centre part where the interface will be built using Silverlight 4.0 and ppl from Control Centre will be using it using normal pc over internet. The 2nd part is based on the Mobile Part where the support Engineer will be sent a communication via some magic that there is a job. And if the support Engineer will accept the job then the job will assigned to his tasks list...
Now the only issue is that how we communicate to the support Engineer on his mobile. We have couple of options...like SMS, Email over SMS etc...
SMS option is costly, so due to the cost management has refused the option, but actually SMS is fine as far as it is sent from the control Centre, but how we get the reply back from the support engineer. Coz we dont want the support engineer send us reply VIA sms coz this will cost him(thats why management refused this option). We have decided a solution that built a custom application for windows mobile which will intercept the coming SMS on the Support Engineer's mobile and will rasie a poupup detailing the job specs and on the same popup there will be couple of buttons like Accept, Reject. what ever the action will be taken it will update the control room via internet/WCF/HTTP. I have no idea how? and thats why I am here.
I am posting all this LOVE STORY so that any body senior can guide me abut the architect if it is ok or not...or any other options we can dig down further.
I appreciate your participation in this regard.
Thanks
Communication to the device is typically the hard part because the device rarely will have a routable network address. Sending an SMS is a reasonable way - so is sending an email (that's how the Microsoft email transport for WCF works). Another option is to have the device periodically "check in" to a server to see if it has any messages waiting.
Communication back is pretty simple. Build up a public web/WCF service that the devices communicate back to. Personally I'd probably lean toward a REST service to keep your mobile connection point a bit more open in the event you want to connect via something that maybe doesn't support WCF.
#Shax I've not done any mobile development but I think you need a WP7 app that will poll control center server over HTTP etc. if there is any job for the engineer. Another option will be to push any job notification from server to mobile. But I am not sure if this (push notification) is easier and/or cost effective.
Another option will be of setting up a website with details of jobs, then you can alert engineer with an SMS. Upon receiving SMS engineer can log into website and get details of the job.

Track messages though Windows Live Messenger

I would like to track messages sent and received though Windows Live Messenger. I would then like to collate these messages into a database (not in the scope of this question).
The question is how and where should I track these messages. The simplest way it to force all clients to keep history files and read those, but it is not really the solution that I am looking for. Is there a way to track them from a server running in the same domain, I have read a little into Windows Communicator, I have also seen a lot of people chat about http://dev.live.com/messenger/ but I was hoping that someone may have addressed this problem already :)
I would like to do this using C# .NET 3.5
Check out MSNPSharp. Its a .NET msn library. Its very powerful and allows you to sign in from multiple locations. So you can sign in and listen to other conversations happening on a given account.
Its very straight forward to use. Download the full source code, there's a sample application that demonstrates its use in full detail.
http://code.google.com/p/msnp-sharp/
Here is two idea that might work.
The first one is the easiest but can be easily avoided by the user if he doesn't want to be logged. It would be to use MSN Plus over the MSN. With MSN Plus you have an API that let you get all messages from any Chat Windows... and a lot more. Of course, if the user is not you, the user can simply uninstall Msn Plus and your program will not log any data.
The second idea is better if you have a network that you require to check all Msn Conversation. If you use WireShark you can see that conversation are not crypted (well the last time I did it) and you can check the port and protocol to simply get the data from the network.
Hope it gives you a way to what you need.
Just two ideas
1. First the standard MSN protocol is plain text (from what I understand) so you could intercept the messages on the firewall and then put them in the DB and do the correlation there.
2. If this is in an organisation you could use Office Communicator which is the "corporate" version of MSN and has that functionality built in already. You can then just go in via their SDK and get the correlated data.
I managed to find two ways of doing this, though both are not really programmatic solutions, so may not appeal to this audience.
Make use of a Jabber gateway to set up forwards between your jabber client and the other IM networks. Traffic flows between your jabber enabled client and the jabber server via the jabber server. The Jabber server then translates this to the destination networks protocol and forwards the message. Likewise messages from the external IM networks are routed and translated by the Jabber server. An example of this is PSI <-> IceWarp Merak <-> MSN
Make use of Symantec IM Manager to intercept messages from the messaging clients on your network. You will need to either use host files or local DNS rules to convince the your local PCs that Messenger.hotmail.com is actually located at 192.168.0.59 and not at Microsoft.
Hope it helps other people that may want to do the same.

How to create an IM bot with C#

Is there an easy way to create an IM bot on multiple im networks (aim, gtalk, yim, etc) that can accept and interpet specific commands sent to it to perform a server related task?
Lets say for instance I have a website for managing an rss feed. I want to send a command to an IM bot to add another feed to my collection. the IM bot would associate my screen name with my account from prior setup on the website.
I have done some internal bots for my company using the XMPP (Jabber) protocol, I've used the agsXMPP SDK and the Jabber.NET client libraries, I was looking for APIS to work with YIM, AIM and Windows Live Messenger but I've found only COM exposed APIS, nothing for .NET...
But an idea comes to my mind, with the XMPP Protocol you can configure a local server with IM Gateways, that allow users to access networks using other protocols through your server
I use eJabberd, you can install a variety of transport gateways to connect with other IM protocols (AIM, MSN, ICQ, GTalk...
To GTalk you can connect directly using the libraries I mention...
A sample ICQ gateway:
The short answer to this question is yes this can be done relitivly easily. Sedning and receiving IMs sending, receiving and interpreting requests from the network you wish to communicate on and there are libraries available for each of the major IM protocols to make this easier.
For messenger you can try the DotMsn library, I have used it in the past but at that time it was still quite new and I have not used it since so I can't vouch for it's quality.
Jabber uses the XMMP protocol which is an open-standard so there are bound to be plenty of client libraries available.
If I recall correctly Google Talk uses this protocol or a modified version thereof.
I dont have experience with c# but I have written one for AIM and Gtalk using PHP. http://www.imified.com/ is the best place to start if you looking for a easier way to write an IM bot.
Basically you create an account in imified.com .
Name your bot and link a script.
When ever a message is sent to the bot, imified.com automatically runs this script.
Here is a link for you get you started!
We have professional .NET/COM/VCL library for MSN/Yahoo/ICQ/AIM/GTalk/Jabber. Please take a look at http://www.imcomponents.com/ if you like.

Whats the best way to send an event to all workstations

I hope someone can guide me as I'm stuck... I need to write an emergency broadcast system that notifies workstations of an emergency and pops up a little message at the bottom of the user's screen. This seems simple enough but there are about 4000 workstations over multiple subnets. The system needs to be almost realtime, lightweight and easy to deploy as a windows service.
The problem started when I discovered that the routers do not forward UDP broadcast packets x.x.x.255. Later I made a simple test hook in VB6 to catch net send messages but even those didn't pass the routers. I also wrote a simple packet sniffer to filter packets only to find that the network packets never reached the intended destination.
Then I took a look and explored using MSMQ over HTTP, but this required IIS to be installed on the target workstation. Since there are so many workstations it would be a major security concern.
Right now I've finished a web service with asynchronous callback that sends an event to subscribers. It works perfectly on a small scale but once there are more than 15 subscribers performance degrades considerably. Polling a server isn't really an option because of the load it will generate on the server (plus I've tried it too)
I need your help to guide me as to what technology to use. has anyone used the comet way with so many clients or should I look at WCF?
I'm using Visual C# 2005. Please help me out of this predicament.
Thanks
Consider using WCF callbacks mechanism and events. There is good introduction by Juval Lowy.
Another pattern is to implement blocking web-service calls. This is how GMail chat works, for example. However, you will have to deal with sessions and timeouts here. It works when clients are behind NATs and Firewalls and not reachable directly. But it may be too complicated for simple alert within intranet.
This is exactly what Multicast was designed for.
A normal network broadcast (by definition) stays on the local subnet, and will not be forwarded through routers.
Multicast transmissions on the other hand can have various scopes, ranging from subnet local, through site local, even to global. All you need is for the various routers connecting your subnets together to be multicast aware.
This problem i think is best solved with socket.
Open a connection to the server, and keep it open.
Could you have a slave server in each subnet that was responsible for distributing the messages to all the clients in the subnet?
Then you could have just the slaves attached to the central server where the messages are initiated.
I think some of you are vastly overthinking this. There is already a service built into every version of Windows that provides this exact functionality! It is called the Messenger service. All you have to do is ensure that this service is enabled and running on all clients.
(Although you didn't specify in the question, I'm assuming from your choices of technology that the client population of this network is all Windows).
You can send messages using this facility from the command line using something like this:
NET SEND computername "This is a test message"
The NET SEND command also has options to send by Windows domain, or to specific users by name regardless of where they are logged in, or to every system that is connected to a particular Windows server. Those options should let you easily avoid the subnet issue, particularly if you use domain-based security on your network. (You may need the "Alerter" service enabled on certain servers if you are sending messages through the server and not directly to the clients).
The programmatic version of this is an API called NetMessageBufferSend() which is pretty straightforward. A quick scan of P/Invoke.net finds a page for this API that supplies not only the definitions you need to call out to the API, but also a C# sample program!
You shouldn't need to write any client-side code at all. Probably the most involved thing will be figuring out the best set of calls to this API that will get complete coverage of the network in your configuration.
ETA: I just noticed that the Messenger service and this API are completely gone in Windows Vista. Very odd of Microsoft to completely remove functionality like this. It appears that this vendor has a compatible replacement for Vista.

Categories