views:

44

answers:

3

I'd like to write and read TCP Streams directly without any modifications by ASP or IIS. Is this possible?

Edit: Goal is to provide communication between a program and a server. Data exchange between them is less then 25 bytes per connection (in default case). So Headers will cause more traffic then the real data. I need to use ASP.Net because the owner of the server will not let me execute my programs.

A: 

ASP.NET is a Web Framework built on the .NET Platform.

What you are asking for doesn't need a Web Framework. You can accomplish everything you need using plain old .NET without using any ASP.NET components.

Justin Niessner
I know. But I need a public server. I found a cheap offer with asp.net support. And they will not let me execute my own .Net programs.
schwer
+1  A: 

Sure, try reading this tutorial to give you an outline of using TCP/IP sockets.

Terrance
I need to do it with ASP.Net.
schwer
Depending on the task it may or may not be all that different. What do you need to actually do ?
Terrance
Client will not be a browser, it's one of my applications. I'd like to do communications with less as possible traffic. Normal Headers are larger then relevant data.
schwer
from your description it sounds like using setting up a web service would be the best way to go more or less depending on how often you wish to communicate with the distant end (owner's site) and what you intend to do with the data. take a look at this and let me know if I'm in the ballpark. http://quickstarts.asp.net/QuickStartv20/webservices/
Terrance
Quick explanation in case your not familiar with web services http://www.15seconds.com/issue/010430.htm
Terrance
I prefer not to use XML. I'll try first Xaqron hints. I hope I don't need it, but thank you.
schwer
I flag this answer also as solution. Edit: Looks like I can't.
schwer
Well alternately you could look into http://en.wikipedia.org/wiki/Windows_Communication_Foundation. Some Xaml involved but definitely a streamlined Web Service setup
Terrance
+1  A: 

ASP.NET even in IIS 7.0 with it's new integrated mode doesn't reveal the underlying socket to your ASP.NET application by default. I'm not sure if there's any hack or third party out there. I think as a web server (IIS 7.0) and web development tool (ASP.NET) using HttpContext and Response objects there are many things you can do like accessing underlying output stream via Response.OutputStream or closing the socket by calling Response.Close() as well.

Xaqron
Could I make responses even if there is 400 Bad Request or 501 Method Not Implemented?
schwer
Yes. Using integreated mode in IIS 7.0 you can handle everything at web server level. These errors are generated by IIS so you can hand over. From IIS 6.0 a kernel level driver (HTTP.sys) handles requests and put them into IIS queue for processing.
Xaqron
With removed Response Header too?
schwer
Yes, just call "Response.Headers.Clear()" in integrated mode
Xaqron
I'll give it a try. Thank you.
schwer
@Xaqron 1+ KISS principle
Terrance