I wish to create a program (really a Windows Service) that sits and
waits for a client PC to communicate with it, but I can't come up with a
good method of doing so.
I want to have a service running on a server, waiting for clients to
send it commands. The service would then do something based on the
command and send the information back to the client. This is exactly
what any database does. What is the best method for doing this?
The only method I can come up with, is that when the client wishes to
communicate with the service it would write a file on the server. The
service would check for the existence of that file every X number of
seconds. Then the service would do it's thing and write back another
file with the results. The client would constantly check every X number
of seconds for the existence of the results file and then read the file.
I, of course, don't like this solution. It's not elegant, it avoids the
whole point, and I can see timing problems throughout.
Is there another way for a service to just "listen" for a stream of data
directly without a file intermediary? What command just "listens"? And
how do you receive a stream of data out of thin air?
Thanks for any ideas. 4 2359
SH wrote: I wish to create a program (really a Windows Service) that sits and waits for a client PC to communicate with it, but I can't come up with a good method of doing so.
I want to have a service running on a server, waiting for clients to send it commands. The service would then do something based on the command and send the information back to the client. This is exactly what any database does. What is the best method for doing this?
The only method I can come up with, is that when the client wishes to communicate with the service it would write a file on the server. The service would check for the existence of that file every X number of seconds. Then the service would do it's thing and write back another file with the results. The client would constantly check every X number of seconds for the existence of the results file and then read the file.
I, of course, don't like this solution. It's not elegant, it avoids the whole point, and I can see timing problems throughout.
Is there another way for a service to just "listen" for a stream of data directly without a file intermediary? What command just "listens"? And how do you receive a stream of data out of thin air?
Thanks for any ideas.
You can create a socket that listens on a specific port (in a windows
service). When that socket is connected to you can do whateever you
want on the server. You can do this through remoting as well.
Chris
Thanks, Chris. I don't know how to do any of this. Can you point me to
any articles, code, etc about creating sockets and using them.
Chris wrote: SH wrote:
I wish to create a program (really a Windows Service) that sits and waits for a client PC to communicate with it, but I can't come up with a good method of doing so.
I want to have a service running on a server, waiting for clients to send it commands. The service would then do something based on the command and send the information back to the client. This is exactly what any database does. What is the best method for doing this?
The only method I can come up with, is that when the client wishes to communicate with the service it would write a file on the server. The service would check for the existence of that file every X number of seconds. Then the service would do it's thing and write back another file with the results. The client would constantly check every X number of seconds for the existence of the results file and then read the file.
I, of course, don't like this solution. It's not elegant, it avoids the whole point, and I can see timing problems throughout.
Is there another way for a service to just "listen" for a stream of data directly without a file intermediary? What command just "listens"? And how do you receive a stream of data out of thin air?
Thanks for any ideas.
You can create a socket that listens on a specific port (in a windows service). When that socket is connected to you can do whateever you want on the server. You can do this through remoting as well.
Chris
SH,
I have not done the socket route but I have created something like this
using .NET Remoting. What you'll need is to create an assembly in which you
have defined an interface. In this interface you'll have a method that takes
a parameter, perhaps the command that the user passes.
Create the remoting server. Create a class in this remoting server that
inherits from MarshalByRefObj ect and implements the interface you defined in
the other assembly. When you start up your service, create the TcpChannel or
HttpChannel (whichever you want, Tcp is faster) with an appropriate port and
register the channel using ChannelServices .RegisterChanne l and then
RegisterWellKno wnServiceType using RemotingConfigu ration using the class
that you created in your service application that implements your interface.
In the client, reference the assembly that contains your interface with the
method call and get an object of that type using Activator.GetOb ject setting
up the ip address and port to be used. Once you have the object, call the
method passing in the command and get its returned data. That's pretty much
it. You should be able to find ample examples of this using Google also.
HTH
Steve
"SH" <sh*****@prupip e.com> wrote in message
news:De******** *********@newsr ead3.news.pas.e arthlink.net... Thanks, Chris. I don't know how to do any of this. Can you point me to any articles, code, etc about creating sockets and using them.
Chris wrote: SH wrote:
I wish to create a program (really a Windows Service) that sits and waits for a client PC to communicate with it, but I can't come up with a good method of doing so.
I want to have a service running on a server, waiting for clients to send it commands. The service would then do something based on the command and send the information back to the client. This is exactly what any database does. What is the best method for doing this?
The only method I can come up with, is that when the client wishes to communicate with the service it would write a file on the server. The service would check for the existence of that file every X number of seconds. Then the service would do it's thing and write back another file with the results. The client would constantly check every X number of seconds for the existence of the results file and then read the file.
I, of course, don't like this solution. It's not elegant, it avoids the whole point, and I can see timing problems throughout.
Is there another way for a service to just "listen" for a stream of data directly without a file intermediary? What command just "listens"? And how do you receive a stream of data out of thin air?
Thanks for any ideas.
You can create a socket that listens on a specific port (in a windows service). When that socket is connected to you can do whateever you want on the server. You can do this through remoting as well.
Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jako Menkveld |
last post by:
I'm building a relatively simple client-server app. One of the functions of
the client is to notify the server when it terminates, this all works fine.
The problem comes in when the server is stopped before the client, in which
case the client "hangs", waiting to talk to the server.
This is how it works:
Server: Starts listening on a tcp port, say 3000 (by registering a
TcpServerChannel and invoking RegisterWellKnownServiceType).
When...
|
by: ssantamariagarcia |
last post by:
I am trying to program a server in C for UNIX to get a kind of "bridge"
between the clients of a port A and the clients of a port B.
For that, I create 2 processes: one that listen the requests of port A
clients and another for the Port B ones.
In each process, when a connetion service is required, after accepting
, the value of the socket generated is added to a set of sockets. This
set keeps on listening on each socket for new...
|
by: Adam Clauss |
last post by:
I am trying to work-around a firewall which limits me to only being
able to accept inbound connections on port 80. Unfortunately, I need
to two different applications to be able to accept connections. I
know of no "standard" way to make this work (and, its quite possible
that I am on the totally wrong track here and there just isn't a way
to do this).
I am trying to determine if it would be possible to write a 'gateway'
program that...
|
by: Dr. J |
last post by:
I have an application that opens a socket and connects to another
application listening over a port. The problem I am encountering is that
when the listening application is closed my application cannot detect it to
take appropriate action. I am using "Connected" property of the Socket
class, but it seems this property does not reflect the true state of the
socket connection.
Here is the code snippet. Basically, I am checking the...
|
by: Dave L |
last post by:
I just upgraded from VS .NET 2002 to 2003. Everything built okay, but
strange bugs started appearing.
Apparently there is a bug in the managed C++ compiler in regards to handling
of static __events. In short, every new instance of the class clears all
existing listening registered delegates. It should, of course, preserve all
delegates since its static, but it does not according to this:
"The real problem is the instance constructor...
| |
by: Gregory Petrosyan |
last post by:
1) From 2.4.2 documentation:
There are two new valid (semantic) forms for the raise statement:
raise Class, instance
raise instance
2) In python:
>>> raise NameError
Traceback (most recent call last):
File "<stdin>", line 1, in ?
NameError
|
by: ppuniversal |
last post by:
hello,
my program snippet:
/*****************************/
/******runThread Function*****/
/*to accept other client connections*/
/*****************************/
DWORD WINAPI runThread(LPVOID param)
|
by: clyfish |
last post by:
In cmd, I can use find like this.
C:\>netstat -an | find "445"
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
UDP 0.0.0.0:445 *:*
C:\>
And os.system is OK.
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
|
by: John Salerno |
last post by:
Let me see if this question even makes sense...I'm reading Core Python
Programming and I jumped ahead to the more specific topics like network
programming. I plan to follow along with the example in that chapter and
create a socket connection between my desktop and laptop.
However, these two computers are already connected on my home network
(using the Windows Network Setup Wizard), so I was wondering if this
will have any effect on what...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |