473,748 Members | 10,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

interprocess comms in local network

guy
In the past I've used sockets in C++ to allow apps to communicate with each
other over a local network. Is there anything better/more advanced in .NET
or should I continue to use sockets and the .NET Socket class under C#?

The (mini) project that I'm about to start will receive stream live data
(stock market prices) and reformat that data and perform some calculations
on it before disseminating it to client applications on the local network.
Some of the machines will have just clients running and some both servers
and clients.

Thanks
Nov 16 '05 #1
5 2648
"guy" <wi*********@ho tmail.com> wrote:
In the past I've used sockets in C++ to allow apps to communicate with
each other over a local network. Is there anything better/more advanced
in .NET or should I continue to use sockets and the .NET Socket class
under C#?


You have various options. If you want something RPC-like (Remote Procedure
Call) then you can use .NET Remoting. This makes it fairly straightforward
for one process to invoke methods on another process.

There are some shortcomings. First, while remoting is good for connecting
two different parts of one application, it is not quite so good for
connecting two independently written applications. It doesn't have any
built-in support for dealing with a situation where each end of the link
evolves independently. This is largely because .NET remoting relies on both
ends sharing a certain amount of type information. (You need to have type
definitions available at both client and server.) It is possible to deal
with this, but remoting doesn't go out of its way to make it easy.

However, if you're always going to release updates to both ends of the
connection simultaneously, this isn't a big deal.

Also, remoting currently has no integrated security support. This changes
with Whidbey - I believe a secure channel will ship with that. Meanwhile,
if you want to secure your remote channel, there's an unsupported way of
doing this on .NET v1.x today:

http://msdn.microsoft.com/library/de...asp?frame=true
http://msdn.microsoft.com/library/de...asp?frame=true
Web Services may be another option. (Indeed, there seems to be a common
idea that these have already deprecated remoting, but that's not accurate.
Each technology has its uses.) Using the web service infrastructure to
receive messages requires you to use ASP.NET. If you don't mind hosting the
app in a web server, that's easy. If you want it to be standalone, that's
possible, but a lot more effort. (You can host ASP.NET in any process you
like.)
But if neither of these looks like a good match for the kind of data you are
sending, or the manner in which you want to send and process messages (the
request/response nature of both of these implementations might not suit your
application) then simple sockets may well be a better bet.
--
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
DevelopMentor - http://www.develop.com/
Nov 16 '05 #2
guy
Hi Ian,

Many thanks for your speedy response.

Since writing I've been thinking that at some point I may want this
application to break out of the local area network and be available on
remote machines across the internet.

I'm thinking that ASP.NET might give me this. Is this right?

On a small local area network do I need to set something special up to use
ASP.NET? You mentioned Web Services. Is this a service that is available on
XP that just needs to be started?
Web Services may be another option. (Indeed, there seems to be a common
idea that these have already deprecated remoting, but that's not accurate.
Each technology has its uses.) Using the web service infrastructure to
receive messages requires you to use ASP.NET. If you don't mind hosting
the app in a web server, that's easy. If you want it to be standalone,
that's possible, but a lot more effort. (You can host ASP.NET in any
process you like.)


Many thanks for your help.
guy
Nov 16 '05 #3
"guy" <wi*********@ho tmail.com> wrote:
Since writing I've been thinking that at some point I may want this
application to break out of the local area network and be available on
remote machines across the internet.

I'm thinking that ASP.NET might give me this. Is this right?
Yes, although in principal Remoting could too. You can configure a remoting
channel to listen on any port you like. And there's an HTTP channel
available too if that's the only thing that will tunnel through your
firewall.

But the web services route would probably be a better solution here. The
reason I say that is that if you are deploying applications out on the
internet, you probably want to use a technology that is as robust as
possible in the face of changing requirements - you're probably not going to
have the luxury of being able to update all the clients simultaneously when
you update the server.

Not that you get this kind of versioning-robustness for free using web
services, it's just easier to achieve.

On a small local area network do I need to set something special up to use
ASP.NET? You mentioned Web Services. Is this a service that is available
on XP that just needs to be started?


ASP.NET provides support for implementing a web service. (Specifically, the
server half of it.) The ASP.NET framework is installed as standard with the
..NET Framework, so if you've got the .NET Framework, you've got ASP.NET.

However, you need a host process in which to run ASP.NET in order to use it.
The usual way of doing this is to use the standard IIS-based hosting. If
IIS was installed when you installed the .NET Framework, it will have set up
the standard IIS-based hosting of ASP.NET. If it wasn't install IIS, and
then run this command:

aspnet_regiis -i

You'll find that command in C:\windows\micr osoft.net\frame work\v1.1.4322.
This configures IIS to allow ASP.NET applications to be hosted. (This adds
an ISAPI extension that directs requests with certain extensions through to
an ASP.NET worker process. This process is called aspnet_wp.exe and is
started up on demand when you first hit an ASP.NET resource via IIS. Unless
you're on Windows Server 2003, in which case it'll call the process
wpw3.exe.)

Once you've made sure ASP.NET is registered with IIS, you can then create a
web service. For example, put a file in \inetpub\wwwroo t and give it a
".asmx" extension, e.g. "MyService.asmx ". Make it something like this:

<%@ WebService language="c#" class="MyServic e" %>

using System.Web.Serv ices;

public class MyService
{
[WebMethod]
public int Add(int x, int y)
{
return x + y;
}
}
You have now exposed MyService.Add as a web service. Try looking at the
http://localhost/MyService.asmx file (or whatever you chose to call it) in
your web browser, and it will generate some documentation telling you how to
use the web service.

You don't have to host via IIS though. The ASP.NET framework is happy to be
hosted in any process. For example, this:

http://www.iunknown.com/000099.html

shows how to host ASP.NET from inside of a Windows Forms application.
If you're using VS.NET, you can get it to generate you a wrapper class to
consume a web service from the client side.
--
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
DevelopMentor - http://www.develop.com/
Nov 16 '05 #4
guy
Thanks for all the info Ian. Let me absorb this and do some further
investigating using the links and ideas that you've given me. Your time and
effort in the reply is much appreciated.

I'll keep you posted on my progress and discoveries...
Nov 16 '05 #5
guy
Hi Ian,

Many thanks for your replies and help a few weeks ago. I got side tracked on
another project but now I'm back on this one.

Has anyone written an article comparing the different methods of
interprocess communication across the internet.

My objective is to write a client/server application.

They won't be very complicated but will do this:

Server
Connects to a live data feed (via Excel) and retrieves data.
Does some calculations on the data.
Distributes data to clients on remote machines on internet.
Server needs to be an application with buttons and menus as it will need to
manipulated while it's running.

Client
Displays the data it receives.
Also an application with menus etc.

I also need to set up permissioning such that only clients that I've
authorized can connect to the server.

Is there a template of this sort of application that I can use as a starting
point.

Many thanks
Guy

"Ian Griffiths [C# MVP]" <ia************ *@nospam.nospam > wrote in message
news:OV******** ******@TK2MSFTN GP14.phx.gbl...
"guy" <wi*********@ho tmail.com> wrote:
Since writing I've been thinking that at some point I may want this
application to break out of the local area network and be available on
remote machines across the internet.

I'm thinking that ASP.NET might give me this. Is this right?


Yes, although in principal Remoting could too. You can configure a
remoting channel to listen on any port you like. And there's an HTTP
channel available too if that's the only thing that will tunnel through
your firewall.

But the web services route would probably be a better solution here. The
reason I say that is that if you are deploying applications out on the
internet, you probably want to use a technology that is as robust as
possible in the face of changing requirements - you're probably not going
to have the luxury of being able to update all the clients simultaneously
when you update the server.

Not that you get this kind of versioning-robustness for free using web
services, it's just easier to achieve.

On a small local area network do I need to set something special up to
use ASP.NET? You mentioned Web Services. Is this a service that is
available on XP that just needs to be started?


ASP.NET provides support for implementing a web service. (Specifically,
the server half of it.) The ASP.NET framework is installed as standard
with the .NET Framework, so if you've got the .NET Framework, you've got
ASP.NET.

However, you need a host process in which to run ASP.NET in order to use
it. The usual way of doing this is to use the standard IIS-based hosting.
If IIS was installed when you installed the .NET Framework, it will have
set up the standard IIS-based hosting of ASP.NET. If it wasn't install
IIS, and then run this command:

aspnet_regiis -i

You'll find that command in C:\windows\micr osoft.net\frame work\v1.1.4322.
This configures IIS to allow ASP.NET applications to be hosted. (This
adds an ISAPI extension that directs requests with certain extensions
through to an ASP.NET worker process. This process is called
aspnet_wp.exe and is started up on demand when you first hit an ASP.NET
resource via IIS. Unless you're on Windows Server 2003, in which case
it'll call the process wpw3.exe.)

Once you've made sure ASP.NET is registered with IIS, you can then create
a web service. For example, put a file in \inetpub\wwwroo t and give it a
".asmx" extension, e.g. "MyService.asmx ". Make it something like this:

<%@ WebService language="c#" class="MyServic e" %>

using System.Web.Serv ices;

public class MyService
{
[WebMethod]
public int Add(int x, int y)
{
return x + y;
}
}
You have now exposed MyService.Add as a web service. Try looking at the
http://localhost/MyService.asmx file (or whatever you chose to call it) in
your web browser, and it will generate some documentation telling you how
to use the web service.

You don't have to host via IIS though. The ASP.NET framework is happy to
be hosted in any process. For example, this:

http://www.iunknown.com/000099.html

shows how to host ASP.NET from inside of a Windows Forms application.
If you're using VS.NET, you can get it to generate you a wrapper class to
consume a web service from the client side.
--
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
DevelopMentor - http://www.develop.com/

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3654
by: Robert Tarantino | last post by:
Hello, I am trying to find a way to create a scheduled task or service that will copy my local profile folders under "Documents and settings" to a network drive. This would allow me to restore my settings if my profile became tampered with or corrupt. Is there any sample code available out there? -Robert
6
2938
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When it finds files with a specific extension, it queries a SQL Server database to determine what workstation will be the destination of a File.Copy. 3. It copies those files to the appropriate workstations on the LAN,
10
4117
by: Woody Splawn | last post by:
I have been developing a ClientServer application on one machine at my office but the time has come to transfer it to the customer. The customer is running a Windows 2000 local area network. I will keep a copy of the applicaiton and all it's code on one of the client machines connected to the local area network at the customers. This machine has a full blown copy of Visual Studio 2003. SQL Server 2000 is the back-end, both at my office...
2
17708
by: ABCL | last post by:
Hi All, Can any one tell me that what is the difference between Network Service, Local Service and Local System ACcount for window services ABCL
3
5451
by: RLN | last post by:
(New to SQL Server Installs) I installed SQL Server 2005 Developer Edition on a WinXP-SP2 workstation and can see some enterprise databases on the network just fine. My problem is I cannot register a local database on the local drive for testing/education purposes. (I accepted all of the defaults on the install and thought all was well.)
22
2670
by: exhuma.twn | last post by:
Hi all, Supposing you have two separate processes running on the same box, what approach would you suggest to communicate between those two processes. Let me list the ones I know of: * Sockets Advantage: Supported per se in nearly every programming language
9
2414
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links. Communications on the Windows PCs use a class derived from CAsyncSocket(). I have written client and server versions of my software for use on the appropriate PCs. I am also using communicating with a legacy DOS based system, with the software...
2
2408
by: Kevin | last post by:
I would appreciate it if anyone could help or advise on coding for comms. I am using C# and need to be able to open a comms port, send a command to a device, receive the data back and close the port. Also need to be able to set up the comms parameters Baud rate stop bits parity etc. Can anyone please advise or help me.
5
6683
by: lmttag | last post by:
ASP.NET 2.0 (C#) application Intranet application (not on the Internet) Using Windows authentication and impersonation Windows Server 2003 (IIS6) Server is a member server on a domain Logged into server as a domain user that is in the local Administrators group on the server Workstation is on the same domain Logged into the workstation as a domain user, which is also in the local Administrators group on the server and workstation
0
8831
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,...
0
9374
jinu1996
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...
1
9325
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,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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();...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.