473,549 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Asynchronous socket programming vs. remoting

I need to write a server app to send images to client GUIs that are outside
of the server's domain.
The client will have the file system path to the image but can not access
the file system.
I am trying to decide if I should use remoting vs. writing a server that
uses networkstreams.

I have read that networkstreams\ tcp programming should be faster than
remoting and is a better choice for what I am doing but that it is difficult
to code.

I'd like to get
1. a recommendation on remoting vs socket programming for what I'm doing
and
2. If socket programming is recommended ... the url of a full sample of
an ansychronous server\client file sharing application.

Thank you,
Michael Lindsey

Nov 16 '05 #1
9 8658
Hello Michael,

I cannot give you a recommandation on what is for your solution the best,
because I just started with .NET. But I can give you example of client /
server using TCP using asynchronous written in Delphi 8. You can email me on
wi******@mestda gh.biz

rgds, Wilfried
http://www.mestdagh.biz
Nov 16 '05 #2
Hello Michael,

I just picked this up from another thread: "Remoting is for when you want to
execute code, but execute it on another ('remote') machine"

So I think Remoting is a kind of Middleware. So I think in your case TCP is
the way to go.

rgds, Wilfried
http://www.mestdagh.biz
Nov 16 '05 #3
Thanks for the replies.
I know what both technologies are. I have written a prototype using
remoting.
But don't have the experience to choose between the two.
I'm looking for recommendations from someone who has experience in remoting
or using a tcp server for a similar architecture.

I'd really like to hears the pros and cons of both options from someone that
has the experience. I have read about the pros and cons for both
technologies from a theoretical perspective.

Thank You,
Michael Lindsey
"Michael Lindsey" <mi**********@a lltel.net> wrote in message
news:FJ******** ******@fe39.use netserver.com.. .
I need to write a server app to send images to client GUIs that are outside of the server's domain.
The client will have the file system path to the image but can not access
the file system.
I am trying to decide if I should use remoting vs. writing a server that
uses networkstreams.

I have read that networkstreams\ tcp programming should be faster than
remoting and is a better choice for what I am doing but that it is difficult to code.

I'd like to get
1. a recommendation on remoting vs socket programming for what I'm doing and
2. If socket programming is recommended ... the url of a full sample of an ansychronous server\client file sharing application.

Thank you,
Michael Lindsey


Nov 16 '05 #4
You have another option that could be good for you - WSE web services.
You can leverage the parm passing and security of wse and use DIME to
transfer your files.
The big issue with Remoting is versioning. As it is strongly typed against
your objects, you have
to change the clients every time you want to remotable types on the server
and visa-versa.
Because wse is soap/xml based, you have a lot more flexability in that
regard. wse also supports tcp, so you can create a tcp based client/server
solution and host it in a service or stand-alone app, etc.

--
William Stacey, MVP
http://mvp.support.microsoft.com

"Michael Lindsey" <mi**********@a lltel.net> wrote in message
news:FJ******** ******@fe39.use netserver.com.. .
I need to write a server app to send images to client GUIs that are outside of the server's domain.
The client will have the file system path to the image but can not access
the file system.
I am trying to decide if I should use remoting vs. writing a server that
uses networkstreams.

I have read that networkstreams\ tcp programming should be faster than
remoting and is a better choice for what I am doing but that it is difficult to code.

I'd like to get
1. a recommendation on remoting vs socket programming for what I'm doing and
2. If socket programming is recommended ... the url of a full sample of an ansychronous server\client file sharing application.

Thank you,
Michael Lindsey


Nov 16 '05 #5
Hello Michael,

I have tried web services, remoting, and direct tcp/ip. Of the three I
prefer tcp/ip (sockets):

- web services are incredibly slow. This is not suprising, considering the
xml processing. But it can go through a firewall. This would be the last
choice for me. Useless for real-time data. In your case, you would have
several layers of overhead: not just the http and xml parsing, but
additionally conversion to and from base64 encoding. I imagine both your
client and server will perform horribly.

- remoting is ok but not as fast as tcp/ip. The other problem is the strong
typing -- you must have a copy of the remoted types on both machines.

- .NET has fairly good support for simple tcp/ip. Performance is great. You
do not need the same assembly on the client and server. Instead, you create
your own protocol, whereby you decide beforehand on the encoding and order
of data. Of the three this is the best, and in many ways the simplest, but
you need an open port.

I don't have a copy of a file sharing program. There is a basic TCP/IP
real-time data communication and visualization program included in the
VG.net samples, under the title Sockets. It uses asynchronous functions in
..NET correctly; not using a separate thread per client, but rather the
functions (BeginWrite/EndWrite/BeginRead/EndRead) that make use of the
thread pool. TCP/IP programming this way is easy. Avoid online samples that
create a separate thread per-client, or try to roll their own thread pool
from scratch. This is not necessary.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

"Michael Lindsey" <mi**********@a lltel.net> wrote in message
news:FJ******** ******@fe39.use netserver.com.. .
I need to write a server app to send images to client GUIs that are outside
of the server's domain.
The client will have the file system path to the image but can not access
the file system.
I am trying to decide if I should use remoting vs. writing a server that
uses networkstreams.

I have read that networkstreams\ tcp programming should be faster than
remoting and is a better choice for what I am doing but that it is
difficult
to code.

I'd like to get
1. a recommendation on remoting vs socket programming for what I'm
doing
and
2. If socket programming is recommended ... the url of a full sample of
an ansychronous server\client file sharing application.

Thank you,
Michael Lindsey

Nov 16 '05 #6
Thanks Frank.
You are the first person that said I should use sockets.
The argument against sockets is usually "all the coding and maintenance"
that it takes to get it working well.
I decided to give it a try and got a real nice solution up and running
quickly, with surprisingly little code, using asynchronous network streams.
The performance is awesome! I am pulling images from FL to GA and loading
them quicker than I can load them from my harddrive using the file system.

It scales nice too - I tried throwing 400 requests at the server in a span
of 30 secs and it returned all images without a hitch.
I was pulling them at 129kb/s and that limitation is likely due to using DSL
over a VPN.
The processor usage during my test never went above 8% on a Pentium II 500
with 1 gig of ram.
The ram usage was at 10 mb but dropped back down to 2-3 mb after each test.
The threads got up around 100 during the test and dropped back down to 6
after the test. The extra threads were due to the asynchronous processing
and it was all handled by the system. I didn't have to create a single extra
thread manually.

Thanks for the advice.

Michael Lindsey

"Frank Hileman" <fr******@no.sp amming.prodiges oftware.com> wrote in message
news:ui******** ******@TK2MSFTN GP09.phx.gbl...
Hello Michael,

I have tried web services, remoting, and direct tcp/ip. Of the three I
prefer tcp/ip (sockets):

- web services are incredibly slow. This is not suprising, considering the
xml processing. But it can go through a firewall. This would be the last
choice for me. Useless for real-time data. In your case, you would have
several layers of overhead: not just the http and xml parsing, but
additionally conversion to and from base64 encoding. I imagine both your
client and server will perform horribly.

- remoting is ok but not as fast as tcp/ip. The other problem is the strong typing -- you must have a copy of the remoted types on both machines.

- .NET has fairly good support for simple tcp/ip. Performance is great. You do not need the same assembly on the client and server. Instead, you create your own protocol, whereby you decide beforehand on the encoding and order
of data. Of the three this is the best, and in many ways the simplest, but
you need an open port.

I don't have a copy of a file sharing program. There is a basic TCP/IP
real-time data communication and visualization program included in the
VG.net samples, under the title Sockets. It uses asynchronous functions in
.NET correctly; not using a separate thread per client, but rather the
functions (BeginWrite/EndWrite/BeginRead/EndRead) that make use of the
thread pool. TCP/IP programming this way is easy. Avoid online samples that create a separate thread per-client, or try to roll their own thread pool
from scratch. This is not necessary.

Regards,
Frank Hileman

check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

"Michael Lindsey" <mi**********@a lltel.net> wrote in message
news:FJ******** ******@fe39.use netserver.com.. .
I need to write a server app to send images to client GUIs that are outside of the server's domain.
The client will have the file system path to the image but can not access the file system.
I am trying to decide if I should use remoting vs. writing a server that
uses networkstreams.

I have read that networkstreams\ tcp programming should be faster than
remoting and is a better choice for what I am doing but that it is
difficult
to code.

I'd like to get
1. a recommendation on remoting vs socket programming for what I'm
doing
and
2. If socket programming is recommended ... the url of a full sample of an ansychronous server\client file sharing application.

Thank you,
Michael Lindsey



Nov 16 '05 #7
That's great! Yes, .NET makes basic scalable tcp/ip easy. You don't need a
lot of code. We just have one small file each for the client and server --
about 2 pages of code, I would say.
- Frank
"Michael Lindsey" <mi**********@a lltel.net> wrote in message
news:ON******** ***@fe39.usenet server.com...
Thanks Frank.
You are the first person that said I should use sockets.
The argument against sockets is usually "all the coding and maintenance"
that it takes to get it working well.
I decided to give it a try and got a real nice solution up and running
quickly, with surprisingly little code, using asynchronous network
streams.
The performance is awesome! I am pulling images from FL to GA and loading
them quicker than I can load them from my harddrive using the file system.

It scales nice too - I tried throwing 400 requests at the server in a span
of 30 secs and it returned all images without a hitch.
I was pulling them at 129kb/s and that limitation is likely due to using
DSL
over a VPN.
The processor usage during my test never went above 8% on a Pentium II 500
with 1 gig of ram.
The ram usage was at 10 mb but dropped back down to 2-3 mb after each
test.
The threads got up around 100 during the test and dropped back down to 6
after the test. The extra threads were due to the asynchronous processing
and it was all handled by the system. I didn't have to create a single
extra
thread manually.

Thanks for the advice.

Michael Lindsey

Nov 16 '05 #8
Remoting is an infrastructure. it relieves you with all the
responsibilitie s regarding serialization etc. With Asynchronous
programming, you will be required to implement the formatters,
serializations and marshalling by yourself. It is not such a good idea
to adopt async.programmi ng when you have a functional infrastructure
provided for free in Remoting.

with regards,
J.V.Ravichandra n
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandra n+J.V.&cob=aspn etpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID= P3966388&BN=999 &PN=2
- Or, just search on "J.V.Ravichandr an"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #9
For communication of a simple protocol and simple sets of primitives (ints,
doubles, byte arrays) I have found basic tcp/ip easier. There is no need for
marshalling or serialization in these cases. You simply write your data to a
memory stream. You only have to create your own protocol.

Remoting brings its own set of headaches to the table.

- Frank

"Ravichandr an J.V." <jv************ @yahoo.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Remoting is an infrastructure. it relieves you with all the
responsibilitie s regarding serialization etc. With Asynchronous
programming, you will be required to implement the formatters,
serializations and marshalling by yourself. It is not such a good idea
to adopt async.programmi ng when you have a functional infrastructure
provided for free in Remoting.

Nov 16 '05 #10

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

Similar topics

6
3474
by: ... | last post by:
Does anyone know a good tutorial on asynchronous programming in .net AsyncCallback And IASyncResult are driving me crazy. And the msdn documentation is not really helpful on this topic I appreciate any recommendation.
5
5635
by: a.kostrzewa | last post by:
I have a question about C#. How can I stop asynchronous read/write operation ( BeginReceive() / BeginSend() ) if timeout occurs? The Socket class doesn't make any cancel method available. I used CancelIo(HANDLE hFile) method (declared in Winbase.h) in C++. Thanks for help. Olek
48
5390
by: Steve - DND | last post by:
I'm trying to determine if I need to make my application multi-threaded, or if it can be done with asynchronous programming. I realize that asynch calls do create a new thread in the background, but when they come back, they return to the thread that launched them, is that correct? If I go multi-threaded, then I just need to spawn a new thread...
7
2370
by: Colin | last post by:
I'm writing a little console socket server but I'm having some difficulty. Can I ask your advice - where is the best place to get some help on that topic? It would be nice if some people who knew what they were doing could take a look at my code and tell me where and why I'm going wrong. Any suggestions of groups or forums?
4
5317
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am trying to decide if I should use remoting vs. writing a server that uses networkstreams. I have read that networkstreams\tcp programming should...
2
6863
by: Macca | last post by:
My app has an asynchronous socket server. It will have 20 clients connected to the server. Each client sends data every 500 millisecondsThe Connections once established will not be closed unless there is a problem with the connection. I need to know which client has sent the incoming data as each client has its own buffer on my "server"...
4
3593
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with...
6
6989
by: Pat B | last post by:
Hi, I'm writing my own implementation of the Gnutella P2P protocol using C#. I have implemented it using BeginReceive and EndReceive calls so as not to block when waiting for data from the supernode. Everything I have written works fine sending and receiving uncompressed data. But now I want to implement compression using the deflate...
2
3413
by: Nicolas Le Gland | last post by:
Hello everyone here. This is my first post in this newsgroup, I hope I won't be to much off-topic. Feel free to redirect me to any better group. I am getting strange timing issues when failing to asynchronously connect sockets on closed or filtered ports, but I'm quite unsure if this is a PHP issue or my misunderstanding, as it seems...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7957
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...
1
7470
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...
0
6043
agi2029
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...
0
5088
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...
0
3500
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...
1
1941
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 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.