Trying to make a app that transfers files over bluetooth in java

I am trying to make a program that will send a audio file (for example test.mp3) to another device.
This would be set up as client - server application.
Ideally, the server would be a PC and the client a mobile device.
Is there any source code similar to this?
Or can anyone help make this?
Thanks.

"You can try the below loop it will allow you to skip Unauthorized files access error:"
Using EnumerateFiles instead of GetFiles doesn't actually avoid the UnauthorizedAccessException that is commonly encountered then SearchOption.AllDirectories is used. There's no way to avoid this problem except by dealing with each directory individually.
And some side notes:
the "select new { File = file }" is completely unnecessary
DirectoryInfo.EnumerateFiles should be used instead of Directory.EnumerateFiles. Enumerating file paths and then creating FileInfo objects is slower than enumerating FileInfo objects in the first place.
No one said EnumerateFiles instead of GetFiles will solve the Unauthorized exception. 
Second comment the property File is used within the loop.
The third comment has no effect with lazy execution, and please prove that it is slower. This comment must be sent against the "GetFiles" method not there."The EnumerateFiles and GetFiles methods
differ as follows: When you use EnumerateFiles,
you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles,
you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are working with many files and directories, EnumerateFiles can
be more efficient."
Reference:https://msdn.microsoft.com/en-us/library/dd383571.aspx
Fouad Roumieh

Similar Messages

Maybe you are looking for