473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 8645
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******@mestdagh.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**********@alltel.net> wrote in message
news:FJ**************@fe39.usenetserver.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**********@alltel.net> wrote in message
news:FJ**************@fe39.usenetserver.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**********@alltel.net> wrote in message
news:FJ**************@fe39.usenetserver.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.spamming.prodigesoftware.com> wrote in message
news:ui**************@TK2MSFTNGP09.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**********@alltel.net> wrote in message
news:FJ**************@fe39.usenetserver.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**********@alltel.net> wrote in message
news:ON***********@fe39.usenetserver.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
responsibilities 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.programming when you have a functional infrastructure
provided for free in Remoting.

with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- 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.Ravichandran"
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

"Ravichandran J.V." <jv************@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Remoting is an infrastructure. it relieves you with all the
responsibilities 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.programming 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
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...
5
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...
48
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,...
7
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...
4
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...
2
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...
4
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...
6
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.