I am developing an intranet application with clients reading images on the server. Each request may be varying in the number of images requested, from 1m to 10m.
What would be the best way for this problem with reasonable waiting time of transfering
Thanks.

How to transfer files in intranet.
Doru Roman
Any overhead comes with a great number of benefits such as scalability, programmability, security, support, ease of use, etc. If your greatest concern is performance I would recommend taking a look at what your performance requirements are for your scenario and determine if IIS/HTTP can support your needs.
That being said, under the vast majority of scenarios I would recommend against creating a custom socket server for something like file retrieval. Unless you have very specific and reproducible concerns for going the custom socket server route you might go down the custom socket server route and discover that creating a robust custom protocol to be more work than you really want to sign up for and support long-term.
HTTP and FTP are well understood, robust, and extremely well-documented protocols for handling the basics of your scenario. If you find that HTTP would indeed satisfy your scenario then IIS is by far the most robust and best-supported approach; either using a static web share model, WebDAV or something dynamic such as ASP.NET. If, for some reason, IIS is not allowed on your intranet and your server is Windows 2003 or XP SP2, then you might want to consider the HttpListener class as well.
HttpListener, also a part of System.Net, allows you to create your own listener for the HTTP protocol without IIS. This will allow you to effectively create a custom HTTP server without having to reimplement HTTP and with minimal footprint. Underneath the covers, HttpListener uses our kernel-model HTTP protocol driver, Http.sys. This is the same driver that IIS uses as well.
Billy Anders
Thottam R. Sriram
LonW
I am interested in the case that the server is a custom socket server.
Can you provide more information for this case, please
Thank you.
Mircea
Arno Nel
If you can share some information on the custom socket server, it would be a big plus.
BTW, which method is preferrable to your opinion, socket server or web server/ftp server, in the scenario of distributed intranet application. This is the ultimost question I am expecting to have an answer.
Thanks very much.
Barrie A Kenyon
So far, one of the reason that I adopt socket is I don't want to install IIS in an intranet environment.
Is it approriate to use ASP.Net in an intranet senario, which is mainly for downloading/uploading files and some message passing
Eric.d
I have problems with uploading files in IIS server. Could you please give me a hand
The code was as follow:
void CMINFODlg::UploadXmlFile()
{
//Initialize wininet.
HINTERNET hInternet = NULL;
hInternet = InternetOpen("Upload XML File", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
if (!hInternet)
{
return ;
}
// Connect to host.
#ifdef _DEBUG
PSTR pszHost = "LOCALHOST";
#else
PSTR pszHost = "SKYNET";
#endif
HINTERNET hConnect = NULL;
hConnect = InternetConnect
(
hInternet, // wininet handle,
pszHost, // host
INTERNET_DEFAULT_HTTP_PORT, // port
"anonymous", // user
NULL, // pass
INTERNET_SERVICE_HTTP, // service
NULL, // flags
NULL // context
);
if(!hConnect)
{
return;
}
// Get Xml File Name
CString cstrMachName = GetMachineName(false);
CString fileNameUpload= _T("/MInfoRpt/Upload/") + cstrMachName + _T(".xml");
// Open the connection
HINTERNET hRequest = HttpOpenRequest (hConnect, _T("PUT"),
fileNameUpload, NULL, NULL, NULL, 0, 0);
if (!hRequest)
{
return ;
}
// Get Xml string for sending
CString xmlString = GetXmlString();
// Upload to the file
BOOL bSendOK = HttpSendRequest ( hRequest
, NULL, 0
, (LPVOID)xmlString.LockBuffer(), xmlString.GetLength());
xmlString.UnlockBuffer();
// Close all the handler and connection
if(!InternetCloseHandle(hRequest))
{
printf( "Error on HttpEndRequest %lu \n", GetLastError());
return ;
}
if(!InternetCloseHandle(hConnect))
{
printf( "Error on HttpEndRequest %lu \n", GetLastError());
return ;
}
if(!InternetCloseHandle(hInternet))
{
printf( "Error on HttpEndRequest %lu \n", GetLastError());
return ;
}
return;
}
The problem is:
This is C++ code inside win32 application. I need upload xml files to IIS server (intranet). But only the machine login with my name and running this application could update files in that upload folder. The code could not create files, only could overwrite the exist files. And the other machine login with others name could not be upload at all. I trace the log file, the files could reach in IIS server but with 401.02. IIS could not accept that files. I believe you are the expert in this area. I need your help. Hope to see your response soon and thanks
OCCcoach
--------------
Typically the HTTP servers already have the infrastructure to do this.
http://www.codeproject.com/aspnet/fileupload.asp gives you some idea in to how to do this without you having to do much coding yourself.
Then you could simply write a WebClient code to upload files.
In the case of download, you don't need to do anything special other than to
simply place the file on the server.
You can use WebClient to download the file
Socket Server
--------------
First you need to have a socket server up and running on port 80 if you plan to
use the HttpUpload/download
Then for the upload case if you plan to use WebClient / http upload you need to
handle the HTTP protocol on the server side. [why would you want to do this ]
In the case of download too, you need to handle HTTP and parse the request and stream the response back. [why would you want to do this again ]
Now lets say you don't want to use HTTP and you want to use TCP at the lower level. In this case you can do anything you want, since there is no protocol.
The server simply listens for some request, [ you need to create your own protocol :-)] and stream the response.
In any case I can't think of why you would want to do anything other than the
HTTP/ASP.NET solution since most of the stuff is already done for you there.
The case might that this is a cross platform situation. Even in that case
you can use some http server there and I am sure there are plugins for http file upload spefic to that server
Fakhrul Islam
Perhaps.
But how much do you care about performance for your file uploads
If you are hardcore then Socket.SendFile may be a better choice
but it requires some development on the server side since you are not using HTTP
Edward van Steenderen
2162
What about the performance between these two approaches
The http approach is not slower than the other one
Sunil Pawar
Can you provide more detail on your scenario. Is the server a file server with a shared folder, a web server, an FTP server or other
If the server is an HTTP server than I suggest using the class System.Net.HttpWebRequest or WebClient. The following code example downloads a file from a HTTP server and stores it in a file.
using System;
using System.Net;
class Test
{
static void Main(String[] args)
{
}
}
However, if the server is a custom socket server, please reply with that fact and I can post additional snippets.
Paulyz
1) IIS is mostly comes with the OS. If it is not installed by default, installing is trivial by using add remove programs/and selecting add remove windows components

2) It is ABSOLUTELY appropriate to install IIS on local intranet scenario. The entire MICROSOFT company uses IIS to report status, reports, installs, what have you.
We use it every second of every day. So it is appropriate
3) I would strongly discourage from using Socket Server.
Why write code when some one has already done that for you
if you have too much time, tell me and I have some projects for you