473,485 Members | 1,405 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select between raw socket programming vs. WCF

Hao
We are doing very intensive network communication. We collect data from
thousands of electric devices every minutes. The devices understand both
socket and web service. They are either embeded linux based system or
Windows based servers. WCF, as I understand, has overhead vs. native socket
..Net programming. Should I continue to use socket programming or look into
the new WCF model?
Thanks.
Hao
Mar 7 '07 #1
9 20609
Hello Hao,

Regarding on your application scenario, since the electric devices are of
different heterogenous platform, therefore, normally we have two
considerable approachs:

1. Use raw socket and deine your own communication protocol to transfer
data between client and server application.

2. Use interopable XML webservice to transfer data

For WCF, it does support XML webservice conform interface/endpoint,
however, to make the webservice communiation interopable, you need to use
basic http protocol/channel. The problem here is that XML webservice over
http will always transfer data in plain XML text format. Thus, any binary
data will need to be encoded and decoded at webservice's server/client
side. Also, such binary-XML encoding will increase the size of the payload.
So for your case, as you said the operations would be performed
frequently, I suggest you still keep using the socket approach.

If you have any further questions or any other concerns, please feel free
to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 8 '07 #2
Hao
I understand and completly agree that socket programming is the most
efficient. Of cause the web service is more open to third party components
and are easier to integrate.
We already spent about a year building and released a new server using web
service to transfer data between .Net and Windows/Linux gsoap engines from
all devices. It works for small to medium data load. We are now
re-architecture because we realized the network traffic is usually
overloaded. Before we go back to sock programming, which we have to develop
our own protocol, we want to know if HTTP compression is valuable in
compacting data? Our data is alreasy strongly typed by gsoap in all devices.
Does WCF support compression? What is the typicall HTTP compression rate? A
lot of our data are strings and floats.
Thanks.
Hao

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:zm**************@TK2MSFTNGHUB02.phx.gbl...
Hello Hao,

Regarding on your application scenario, since the electric devices are of
different heterogenous platform, therefore, normally we have two
considerable approachs:

1. Use raw socket and deine your own communication protocol to transfer
data between client and server application.

2. Use interopable XML webservice to transfer data

For WCF, it does support XML webservice conform interface/endpoint,
however, to make the webservice communiation interopable, you need to use
basic http protocol/channel. The problem here is that XML webservice over
http will always transfer data in plain XML text format. Thus, any binary
data will need to be encoded and decoded at webservice's server/client
side. Also, such binary-XML encoding will increase the size of the
payload.
So for your case, as you said the operations would be performed
frequently, I suggest you still keep using the socket approach.

If you have any further questions or any other concerns, please feel free
to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Mar 9 '07 #3
Hao,

Another option you might want to look at is Efficient XML, the
cross-platform binary XML protocol being standardized by the W3C. I work for
the company that developed it and we have implementations for both .NET and
Linux. The compression ratios are quite good. See
http://www.agiledelta.com/product_efx.html.

Hope this is helpful!,

John

"Hao" wrote:
I understand and completly agree that socket programming is the most
efficient. Of cause the web service is more open to third party components
and are easier to integrate.
We already spent about a year building and released a new server using web
service to transfer data between .Net and Windows/Linux gsoap engines from
all devices. It works for small to medium data load. We are now
re-architecture because we realized the network traffic is usually
overloaded. Before we go back to sock programming, which we have to develop
our own protocol, we want to know if HTTP compression is valuable in
compacting data? Our data is alreasy strongly typed by gsoap in all devices.
Does WCF support compression? What is the typicall HTTP compression rate? A
lot of our data are strings and floats.
Thanks.
Hao

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:zm**************@TK2MSFTNGHUB02.phx.gbl...
Hello Hao,

Regarding on your application scenario, since the electric devices are of
different heterogenous platform, therefore, normally we have two
considerable approachs:

1. Use raw socket and deine your own communication protocol to transfer
data between client and server application.

2. Use interopable XML webservice to transfer data

For WCF, it does support XML webservice conform interface/endpoint,
however, to make the webservice communiation interopable, you need to use
basic http protocol/channel. The problem here is that XML webservice over
http will always transfer data in plain XML text format. Thus, any binary
data will need to be encoded and decoded at webservice's server/client
side. Also, such binary-XML encoding will increase the size of the
payload.
So for your case, as you said the operations would be performed
frequently, I suggest you still keep using the socket approach.

If you have any further questions or any other concerns, please feel free
to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.


Mar 10 '07 #4
Thanks for your reply Hao,

For WCF, so far there hasn't built-in compression setting(for http or
non-http channel). If your service will transfer some binary data, one
thing you could have a look is the MTOM encoding in WCF(also supported in
WSE 3.0):

Here are some web articles mentioned something about large data transfer in
WCF:

#Moving lots of data
http://wcf.netfx3.com/blogs/wcf_team...21/Moving-lots
-of-data.aspx

#Choosing a Message Encoder
http://msdn2.microsoft.com/en-us/library/aa751889.aspx

#Large Data and Streaming
http://msdn2.microsoft.com/en-us/library/ms733742.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 12 '07 #5
Hello Hao,

How are you doing on this issue, have you got any further ideas or does the
information in my last reply helps a little also? If there is still
anything we can help, please don't hesitate to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 15 '07 #6
Hao
Hi, Steven,
I spent a few days testing various bindings in WCF and found that using MTOM
achieves the best results in my case. I setup many clients built on WCF
running full speed to push data to my server via MTOM. The server consumed
about 8M bytes per second of data, which seems to be pretty good since my
LAN speed is only 100Mbps.
The next step is to figure out if gsoap on linux side can work with WCF via
MTOM. I am sure byte array works, but I like to see rich objects can be
serialized and deserialized automtically through MTOM. I know gsoap supports
MTOM. We alreasy passed the rich objects between gsoap and .Net 2.0 via ASMX
web services.
Any hint there? I have to wait for a few days until another developer has
time to develop the gsoap side.
Thanks.
Hao

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:Te****************@TK2MSFTNGHUB02.phx.gbl...
Hello Hao,

How are you doing on this issue, have you got any further ideas or does
the
information in my last reply helps a little also? If there is still
anything we can help, please don't hesitate to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Mar 19 '07 #7
Thanks for your followup Hao,

Sure, if possible, using MTOM is the preferred choice. For normal byte
array transfer in webservice, they're encoded through base64 encoding
format which will add 33% overhead. And MTOM encoding will try keep the
original binary data as much as possible so as to have the minest size.

I'm not familar with gsoap, however, if MTOM is supported, I think you're
certainly recommend to use it for communicating with WCF webservice
endpoint.

Please feel free to post here if you get any further progress or there is
anything else we can help you.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 20 '07 #8
Hao
My client and service are configured to use MTOM encoding and
basicHttpBinding. After I inspect the network traffic, I am surprised to see
the rich objects are actually transferred as XML data. Did I set the
encoding wrong? I though MTOM encoding will choose either base64 or binary
raw format to transfer data as attachment. Maybe I misunderstood the MTOM.
Does MTOM work for rich objects such as array of structures as well as byte
arrays?
Thanks.
Hao

"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:zT**************@TK2MSFTNGHUB02.phx.gbl...
Thanks for your followup Hao,

Sure, if possible, using MTOM is the preferred choice. For normal byte
array transfer in webservice, they're encoded through base64 encoding
format which will add 33% overhead. And MTOM encoding will try keep the
original binary data as much as possible so as to have the minest size.

I'm not familar with gsoap, however, if MTOM is supported, I think you're
certainly recommend to use it for communicating with WCF webservice
endpoint.

Please feel free to post here if you get any further progress or there is
anything else we can help you.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.

Mar 20 '07 #9
Thanks for your reply Hao,

For service that enable MTOM binding, it will only apply on those data that
are declare as binary stream, such as byte[] (byte array). For other text
type or custom class object, they'll still be serialized as XML/text
stream(over webservice http transport binding).

#Large Data and Streaming
http://msdn2.microsoft.com/en-us/library/ms733742.aspx

For example, given the following contract:

[DataContract]
class MyClass
{
[DataMember]
byte[] rawData;
[DataMember]
string textData
}

only "rawData" (byte array) will benefit the MTOM encoding. MTOM do not
know anything about custom data type serialization/deserialization, it only
care about encoding binary data as raw byte stream format and wrapper them
with a multi-part MIME package.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 22 '07 #10

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

Similar topics

0
1383
by: Rob | last post by:
Hello, I've got a huge problem with async sockets. I've created a networked virtual environment, using async socket programming. The problem I face occurs when I close the listener socket. It...
2
13719
by: Jean-Philippe Guyon | last post by:
Hello, I am trying to compile a class that uses socket using the Visual C++ ..NET compiler. I get the following error: ------ Build started: Project: infCommon, Configuration: Release Win32...
2
6955
by: chellappa | last post by:
Hi Every body!, i did a small Chat program in Linux C Socket Programm ... I am using stdout/stdin i did in single machinee i will work properly..but i want to run in differnet machine..i tried...
3
881
by: zbcong | last post by:
hello i found there are three socket programming architectures from dotnet:synchronized socket,asynchronized socket and TcpListener. i know that the asynchronized socket is non-blocking socket.i...
5
3668
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose...
1
3375
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
4
3164
by: Marco Meoni | last post by:
Hi. I read the Gordon McMillan's "Socket Programming Howto". I tried to use the example in this howto but this doesn't work. The code is class mysocket: '''classe solamente dimostrativa -...
8
4663
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi all, I am new to .net technologies. ASP.NET supports socket programming like send/receive in c or c++? I am developing web-site application in asp.net and code behind is Visual C#. In...
9
2465
by: srbakshi | last post by:
Hi all, I have a small problem. I am trying to download a JPG image from a server using C socket programming. I use the following to "recv" the byte stream and store it into a file I call...
0
6957
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
7111
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
7155
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...
1
6820
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...
0
7258
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...
1
4856
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...
0
3049
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...
1
593
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
242
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...

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.