|
consider the scenario when the folder is not shared. As i have to access a file which is located at C:\Windows, so no one like to access that file over the network. so is there still any possibility?
sAqIb
|
|
|
|
|
Nope. But you could grant access to that file ony to one user so nobody else could access it.
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
there must b some way to do that
sAqIb
|
|
|
|
|
I am pretty shure that there isn't. I mean just think for a moment. What if you ware able to mess around with other peoples files over the network. Not a happy place, eh?
--------------------------------------------------------
My portfolio & development blog
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
So long as you have admin permissions to the remote PC, the UNC path to the Windows folder (without any additional shares) would be "\\machineName\C$\Windows\filename". This is what you would use for opening your files.
But this is dependant on your network environment. If the machines are setup in Workgroup mode, you'll probably have problems because the account that your code is running under doesn't have permissions to the remote PC. Each machine maintains its own set of user accounts.
If in a domain environment, this gets much easier, since domain user accounts are common to all machines in the domain.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
I have created a chat application, and one of it's functionality to send files to the connected user.
I read the contents of the files into a Byte array and send that through sockets.
Now when i send a file of 150 kb size the file seems to be corrupted at the receivers end.
some part of the file is not received.
Is there any restriction of size for sending files across internet using sockets?
I am able to send small files without any problem.
When i run the same application locally, i am able to send huge files of 3-4 MB easily.
Can anyone point out why this is happening?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Hi,
System.IO.FileStream fstream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
byte[] buffer = new byte[fstream.Length];
fstream.Read(buffer, 0, buffer.Length);
fstream.Close();
//writing to the network stream//
outStream = this.Client.GetStream();
for (int i = 0; i < buffer.Length; i++)
{
//outStream.Write(buffer, 0, buffer.Length);
outStream.WriteByte(buffer[i]);
}
I have used this and its working correctly....
nishu
|
|
|
|
|
Thanks for the reply,
but i have a defined format of the messages that are sent across.
And i send the file contents in that message i.e.
i read the bytes of the file and send that at once.
is that creating any problem?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
Can you please tell me how you are doing ecxactly coz I have creadted a similar kind of application in which I have a seperate thread to process the sending of the file.
You are sending in a message format right?i didnt get that part of yours acxactly.
Can you please tell me in little detail so that i can help you ,
Other side at recieving end what are you doing?you are parsing your messages ?
--
nishu
|
|
|
|
|
ok, just tell me how do i create a separate thread to receive file from the same socket stream?
Becuase what i want is during the file transfer if some sends some text message that message should also be received and displayed.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
I was on vacation thats y I coudnt answer your question that time,
See what you do,send some special message for sending the file ,after receiving the message from the other side open new socket with specific port in different thread,and continue the process ,after reaching end of the file,close that socket.You will have to implement theading for multiple file transfer or everyting will be messed up.
Now you must have got your answer ,right?
If you face any more difficuties post me,ok?
enjoy buddy
nishu
|
|
|
|
|
ok, now one question,
wht if the user is connected to more than one buddies and while some one is sending file to this user, some one else sends some text message.
Do u think these messages will mess up as they will be received thru the same port.
Also is there any chances of exception when 2 threads are using the same port?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
how to identify whether a dropped object in my application is a file or a folder.
atpresent, i am using File.Exists method and Directory.Exists.
Is thr any other way to find out.
Actually if we rightclick a file or folder and select properties... it will tell us whether it is a file or folder(Type: FileFOlder or File)
any ways to retrive tht information.
I am using C# application.
|
|
|
|
|
this depends on the input you get.
where do you retrieve the file/folder list from and how does it structure look like?
If you can not make a difference between files and folders in the input you will have to do it as you currently do.
So please tell me how your input (of files/folders) looks like.
|
|
|
|
|
I assume you receive the path of the dropped object. If so you could do the following:
bool isDirectory = ((File.GetAttributes(path) & FileAttributes.Directory) == FileAttributes.Directory);
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank u both for guiding me.
|
|
|
|
|
how i can create a mobile application in C#.
plz reply me as soon as possible thanks.
|
|
|
|
|
Hello
It depends on what model you want you app to run.
If you are programming for smartphones use .Net compact framework.
If you are programming for symbian use Appforge CrossFire[^].
Regards
|
|
|
|
|
ok
i need a small application on smartphones in C#.thanks
|
|
|
|
|
Create Smart Device application. File -> Project -> Visual C# -> Smart Device
only two letters away from being an asset
|
|
|
|
|
Dear all,
I have add a listbox with following property on
listbox1.DrawMode=OwnerDrawVariable;
listbox1.HorizontalScrollbar=true;
listbox1.ScrollAlwaysVisible=true;
I am overriding the DrawItem event of the ListBox for drawing item's text. Some text are too big to fit in the list box. But the Horizontal Scrollbar is not enabled or working. Horizontal scrollbar is visible and [disable or dim]. Vertical scrollbar is working fine.
Please help.
|
|
|
|
|
Hello
Listboxes implement auto horizontal scroll by default. Why do you do all this?? Once you input an item that has a long enough text, the horizontal scrollbar should appear with the proper size!!
If you want to set this manually -for one reason or the other- don't forget to set ListBox.HorizontalExtent to the right size.
Regards
|
|
|
|
|
Thanks Nader,
My Problem has resolved. I was not using HorizontalExtent. Now i realize this is important property. So very very thanks.
Now I have a samll question too. What is the easiest way to give a shortcut key to a Button in C#. Like Ctrl+S or F6 etc.
Thanks...
|
|
|
|
|
I have been working with RegistryKeys (Create, Delete, Modify) however i do not know how to read the whole registry. I am looking for certain keys, but they end up being all over the place. I need to be able to identify their exact path.
I am working in Windows Forms C#
Thanks
|
|
|
|
|
Hello
oskardiazdeleon wrote: i do not know how to read the whole registry
The registry is a tree of keys. The main 5 are present in the System.Win32.Registry Class. You can access them one by one using recursive calling to scan all subkeys but that will be very lenthy!!
oskardiazdeleon wrote: I need to be able to identify their exact path.
Be carful when -or if- you scan the registry of similar names. You should identify your key by its full name. Besides the registry structue is quite constant for a given windows version. What you are looking for will probably be in the same location on other machines running the same version.
Regards
|
|
|
|