Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a question regarding a Windows C# services.
Is it possible for the window service to run in background and send/Receive its data to a C# standalone application with opened by a user. if so how is it that it can be done?
Is there any other better ways for building a window service
Yes this can be done, and there are several options. For inter-process communication - which is basically what you are asking for - you could consider WCF with NamedPipes or TCP, or a message queue (MSMQ, RabbitMQ etc).
Typically with a message queue the messages will queue if the service or client is not there, or with named pipes or TCP a current connection must be available.
WCF named pipe minimal example
Yes, it's possible. You can run a service like windows service, expose methods, and one or more client can use it.
One example is this.
Bye bye.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Trying to make console app that monitors alongside its main program, and monitors what the main program has going in and what goes out its tcp/ip sockets. I have seen people do this in a few programs, but I can't figure out how. Something about using a raw socket, but I am not sure.
Any ideas how?
If you want the console app to be entirely separate from the main program, you can do this various ways:
Create a man-in-the-middle proxy for the connections. Run a client and server socket from your console application - i.e. clients connect to your proxy server and then your proxy server will forward the connection to your main program. This allows you to record the packets on their way through your console.
Hook winsock.dll. Essentially you will be gaining access to the parameters of send() and recv() calls that your main program makes, and you can then output or do as you like with it.
Forget programming it, and use Wireshark or another network sniffer to check what's going in or out.
More information on number 2:
It was surprisingly difficult to find good tutorials in C#, mainly because it's generally done with C++ or C. Some links to get you started:
https://en.wikipedia.org/wiki/Hooking
http://csns.calstatela.edu/download.html?fileId=2062150
http://www.elitepvpers.com/forum/co2-programming/1917917-c-dll-injecting-hooking.html
A tool to assist with hooking: http://easyhook.codeplex.com
I'll update this list as I find better resources. I might make a tutorial myself, will keep you informed.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want call a method accepting a string as parameter on a console application from a completely different application. Purpose of the call is simply write a line to the console window from a different application for posting some debug lines. What could be the best way to achieve this? (I have control of both application sources)
You could use anonymous pipes (on local machine) or named pipes (if you require the processes to communicate over network as well). Pipes are very common way for processes to communicate, other solutions include memory mapped file where the processes exchange messages or, and I very much discourage you to do this, a directory where messages are exchanged in form of files being created and their creation observed using FileSystemWatcher.
You can see an example of names pipes in action on How to: Use Named Pipes for Network Interprocess Communication on MSDN. The example demonstrates two processes where one of them uses NamedPipeServerStream and the consuming processes use NamedPipeClientStreams to be able to intercept the incoming messages from the server application.
Here's an example of the same thing using anonymous pipes, if you don't require the processes to work over the network.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a project to create a messaging system for iOS, Android, web browser as the client. What kind of protocol can i use? I have read about the HTTP and Socket programming. Some solution that come up:
GET/POST HTTP
Socket
If we have the socket programming, how can we arrange the socket connection with the load balancing?
Any idea which one can I apply or other protocol?
Thanks
My first plan is to create something like a usual chatting app we know nowadays, but integrated with some other functions in the current system. Which one should I use?
I strongly recommend that you use an established protocol, IRC. For a general overview of IRC see http://en.wikipedia.org/wiki/Internet_Relay_Chat
Read about one Android library implementation at IRC library for Android (From 2.3.3 to 4.0.3 )?
This could go a long way towards solving your problem. Mainly though, "don't reinvent the wheel" as the saying goes.
You can check SignalR to use on the Website part. This will allow you to create real time connections. It uses WebSockets:
http://signalr.net/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to incorporate RabbitMQ based pub sub for a specific programming scenario,
I have a Web API endpoint. When I get a 201 response from this service I want to send out emails.
I already have another API endpoint which I can call to send out email.
Where do I setup the mailer?
And how do I setup RabbitMQ to handle this scenario?
To clarify further, should this be a fanout exchange setup or not? And how are mails usually handled transient or persistent queues?
Sounds like a typical worker scenario where one side will queue up jobs/messages into a message queue (producer) and the other side will get the messages and process them (consumer/worker). In your case, the workers will get messages and send out an email (or hit your api endpoint that sends out emails). The workers typically run on separate machines so they can do work without affecting your application or api.
If you're using RabbitMQ, you should read the "Work Queues" tutorial to see how to set it up for your scenario: http://www.rabbitmq.com/tutorials/tutorial-two-python.html
There are some hosted solutions specifically for this too that don't require any setup like IronMQ for a message queue. Or even a step further if you don't want to deal with worker servers, you can use IronWorker.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 months ago.
Improve this question
what do I need to study before programming a windows chat application in C#?? Moreover, can you recommended me books names or tutorials links about this topic??
You'll need to understand interprocess communication if you want to make a "chat" application.
Typically, in C#, this is currently handled via Windows Communication Foundation. That would be a good place to start.
It depends on the specific requirements for your chat program. Is your application going to be web-based (runs in the browser) or will people need to download a program for it to work? Will communication be handled directly from one computer to another (peer-to-peer), or will there be a central server that handles communication? Will there be "chat rooms" where more than two people are chatting together at once? Will chat conversations be encrypted for privacy? Will chat conversations be saved?
Depending on your answers to these questions, you may want to look into:
Windows Communication Foundation
Asp.net MVC
SQL Server
Entity Framework or LINQ to SQL
Interprocess communication
AJAX
JSONP
Windows Presentation Foundation or Windows Forms
... and possibly others as well.
If you don't know where you're going, any road will get you there. -- The Cheshire Cat