473,769 Members | 5,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5937

"Tom" <To*@discussion s.microsoft.com wrote in message
news:39******** *************** ***********@mic rosoft.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*@discussion s.microsoft.com wrote in message
news:39******** *************** ***********@mic rosoft.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 = @"\\MyRemoteSer ver\MyShare\MyP ath\"

try
{
if (File.Exists(Lo calPath + "MyTestFile.txt ") &&
Directory.Exist s(RemotePath))
{
File.Move(Local Path + "MyTestFile.txt ", RemotePath +
"MyTestFile.txt ");
}
}

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

Does this help?

Thanks,
Tom

Feb 22 '07 #4
"Tom" <To*@discussion s.microsoft.com wrote in message
news:8D******** *************** ***********@mic rosoft.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 = @"\\MyRemoteSer ver\MyShare\MyP ath\"

try
{
if (File.Exists(Lo calPath + "MyTestFile.txt ") &&
Directory.Exist s(RemotePath))
{
File.Move(Local Path + "MyTestFile.txt ", RemotePath +
"MyTestFile.txt ");
}
}

catch (Exception e)
{
Console.WriteLi ne("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*@discussion s.microsoft.com wrote in message
news:09******** *************** ***********@mic rosoft.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*@discussion s.microsoft.com wrote in message
news:69******** *************** ***********@mic rosoft.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
16270
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 example check out: http://stealthtests.lockdowncorp.com/ On that site, there are tests that will display NetBIOS & MAC addresses.
5
3850
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 1033. Is this the correct port number, and how do I change the port?
10
1649
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 connects to the server, makes a request, and awaits a response. The server sends back the response at which point the client disconnects. The connection takes place on port 20198 (TCP). My server app was coded in such a way that only 10...
7
1519
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 -> SQL User Database, Application Server, SQL application database. then what technology would I typically use to communicate between the IIS machine in my DMZ and the SQL user database?
6
4016
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 through our firewall. We have another server (Server1) within the SBS domain that is exposed through port 80 of the firewall on which we host some web services and images. What is the best architecture for getting the file from the remotely...
1
1835
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 a netgear firewall/router (FVS124G). This is my first ftp application. My issue is that when the remote client requests a passive connection (PASV), the ip/port returned to the application are not in the range that I specified in the server's...
1
1753
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 also a windows application will be created as well so the users can view the data that was submitted off the public website. My question is if I have the web service behind the firewall and connect by opening a port to retrieve the data once the...
2
1788
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
1617
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
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10212
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10047
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7410
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.