473,382 Members | 1,386 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,382 software developers and data experts.

File.Move & Firewall Port

Hi,

I need to copy and/or move files across servers to the other side of my
firewall. I was wondering if anyone can tell me what port(s) I will need to
open to run these methods in my C# program?

TIA,
Tom
Feb 22 '07 #1
8 5896

"Tom" <To*@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
Hi,

I need to copy and/or move files across servers to the other side of my
firewall. I was wondering if anyone can tell me what port(s) I will need
to
open to run these methods in my C# program?
The C# program, .NET runtime, copy or move and even files doesn't affect the
problem at all. What service/protocol are you using for the transfer? FTP,
SCP, SFTP, WebDAV, Windows File Sharing, NFS, etc?

Essentially you need the same access to the remote server that you need when
performing the operation by hand from the machine where your code will run.
Feb 22 '07 #2
"Tom" <To*@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
Hi,

I need to copy and/or move files across servers to the other side of my
firewall. I was wondering if anyone can tell me what port(s) I will need to
open to run these methods in my C# program?

TIA,
Tom

It depends on the protocol used (NetBIOS over TCP or SMB direct hosting) and your
authentication requirements (NTLM or Kerberos). NBT uses ports 137, 138 and 139, wile SMB
hosting uses port 445.
NTLM uses port 135.

For a complete list of all possible ports used by Windows Services check this:

http://www.microsoft.com/smallbusine...s_ms_prod.mspx

Willy.

Feb 22 '07 #3
Ben,

I am not sure what is happening under the covers so I am not quite sure your
post is helpful.

Here is a simply code snippet that may clarify things a bit:

class MoveIt
{
public static void Main()
{
string LocalPath = @"c:\temp\";
string RemotePath = @"\\MyRemoteServer\MyShare\MyPath\"

try
{
if (File.Exists(LocalPath + "MyTestFile.txt") &&
Directory.Exists(RemotePath))
{
File.Move(LocalPath + "MyTestFile.txt", RemotePath +
"MyTestFile.txt");
}
}

catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
}

Does this help?

Thanks,
Tom

Feb 22 '07 #4
"Tom" <To*@discussions.microsoft.comwrote in message
news:8D**********************************@microsof t.com...
Ben,

I am not sure what is happening under the covers so I am not quite sure your
post is helpful.

Here is a simply code snippet that may clarify things a bit:

class MoveIt
{
public static void Main()
{
string LocalPath = @"c:\temp\";
string RemotePath = @"\\MyRemoteServer\MyShare\MyPath\"

try
{
if (File.Exists(LocalPath + "MyTestFile.txt") &&
Directory.Exists(RemotePath))
{
File.Move(LocalPath + "MyTestFile.txt", RemotePath +
"MyTestFile.txt");
}
}

catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
}

Does this help?

Thanks,
Tom
Your code uses the SMB protocol (all or not using NBT), to copy a file to a remote shared
folder, please see my other post for details about the ports to open.

Willy.


Feb 22 '07 #5
Willy,

Thanks for your posts. I have been researching them (DFS and SMB) and it is
very helpful but I have one more question due to our environment that I would
like to run past you.

The destination server is not within my AD tree. I am using a replicated
local user account for the authentication mechanism.

Does this fact change your recommendation?

Thanks again,
Tom
Feb 22 '07 #6
"Tom" <To*@discussions.microsoft.comwrote in message
news:09**********************************@microsof t.com...
Willy,

Thanks for your posts. I have been researching them (DFS and SMB) and it is
very helpful but I have one more question due to our environment that I would
like to run past you.

The destination server is not within my AD tree. I am using a replicated
local user account for the authentication mechanism.

Does this fact change your recommendation?

Thanks again,
Tom

No it doesn't, the fact that you are using a shadow account does not eliminate the NTLM
authentication handshake.
Again, as I said before, try to get rid of NBT and opt for "SMB direct hosting", this way
you don't need to open the NetBIOS related ports 137, 138, 139.

Willy.
Feb 22 '07 #7
Willy,

I can see why you are an MVP!! Honestly, this low level networking stuff is
a bit over my head.

I believe what you mean by get rid of NBT is change the resolution scheme in
the method’s destination from Net BIOS, which I believe is the name
resolution mechanism that is resolving the UNC (i.e.
//server/share/path/file), and replace it with something else, preferable SMB
Direct Hosting.

I am not sure what this equates to a couple of abstraction layers up in the
destination of the File.Move method but do I need to change to a URL or a
FQDN?

Are these resolution schemes utilizing SMB Direct Hosting?

Thanks again,
Tom

Feb 22 '07 #8
"Tom" <To*@discussions.microsoft.comwrote in message
news:69**********************************@microsof t.com...
Willy,

I can see why you are an MVP!! Honestly, this low level networking stuff is
a bit over my head.

I believe what you mean by get rid of NBT is change the resolution scheme in
the method’s destination from Net BIOS, which I believe is the name
resolution mechanism that is resolving the UNC (i.e.
//server/share/path/file), and replace it with something else, preferable SMB
Direct Hosting.

I am not sure what this equates to a couple of abstraction layers up in the
destination of the File.Move method but do I need to change to a URL or a
FQDN?

Are these resolution schemes utilizing SMB Direct Hosting?

Thanks again,
Tom

Well, there are two network protocols that can be used to piggy-back the SMB protocol in
Windows:
1. NetBIOS over TCP/IP (NBT), and
2. SMB "direct hosted", that is SMB over TCP/IP.

1 above uses NetBIOS name resolution (and possibly WINS), and is disabled when you disable
NetBIOS over TCP/IP in your network set-up options (per adapter). 2. Is always enabled
(unless you disable File/Printer sharing) on W2K and higher, and uses the DNS name
resolution protocol.
The MPR will automatically select SMB hosting when the UNC path specifies a FQDN DNS name
(or an ip address or an alias name) and not a NetBIOS name. You can force SMB-hosting for
all SMB traffic, simply by disabling NetBIOS over tcp/ip in your network settings.
In your specific case, you simply have to put the IP hostname name or IP address as the
server in the UNC path, if you don't have (or don't want to use) a DNS server available, you
can put the host name in your hosts file (FQDN and alias) and you can disable NetBIOS over
TCP/IP.

Willy.

Feb 22 '07 #9

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

Similar topics

2
by: Snuffy2 | last post by:
I'm looking to try to get a users MAC and/or NetBIOS name when they visit my website. It somehow can be done, I'm not sure with PHP, but it can be done. Does anyone have any idea how? As an...
5
by: William F. O'Neill | last post by:
Am using Powerbuilder 8.0.4 and SQL Server 2000. Have just installed Windows XP SP2, and can no longer connect to my SQL Server db. Someone suggested that I need to reset the port for the db at...
10
by: Shaniqua Jones | last post by:
I've designed a C# application consisting of two EXEs: a client and server. The server runs on my Win2000 Server box, and the client runs on my customers' machines -- typically XP. The client app...
7
by: Dan Walls | last post by:
Hi, I just had a question regarding forms authentication using a SQL database backend. If my (planned)architecture is: Internet -> firewall -> DMZ (IIS - access to User Interface) -> Firewall...
6
by: Pat Carden | last post by:
Hi, We need to allow webusers to upload a file on our website (on Server3, all servers run Server 2003, remotely hosted) and eventually save it on our SBS Server (Server2) which is not exposed...
1
by: Pete | last post by:
I'm writing an FTP application in C# and decided to try SafeTP(http://www.cs.berkeley.edu/~smcpeak/safetp/) for data encryption. The FTP Server is running on a 2003 Server w/IIS 6.x and is behind...
1
by: kimberly.walker | last post by:
Im new to creating a web service..... I have a public web page that collects data this is stored in an .mdb. The plan is to create a web service behind the firewall to get the data from the .mdb...
2
by: archana | last post by:
Hi all, I am new to remoting. I heard that binary formatted data will not work through firewall. And soap formatted data will work Can anyone tell me why is it so? thanks in advance.
2
by: GaryDean | last post by:
We were calling out to a web service just fine before we put our server behind a firewall. Now we can't call out. Port 80 is open in the firewall. What ports need to be open? -- Regards, Gary
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.