Login  
Search All Forums
Dart Home | Custom Development Reply | General Questions Topics | Forums   
AuthorForum: General Questions
Topic: File transfer problem using OTP
rovicohen

From: New York, NY USA
Posts: 24
Member Since: 09/19/05
posted June 8, 2012 12:09 PM

Hello

we are using Dart.PowerTcp.Otp.dll ver(1.0.0.1).

we are transferring some files from one machine to another machine.
On same machine it working fine.
But when we send files on another machine then it show "Access to the path "C:\abc.jpg' is denied."
we have used the following code:-
for write using OTP-
Dim o As Object
if FileExists(filename) then
o = New FileInfo(filename)
o.attributes = (o.attributes And Not FileAttributes.Hidden)
Dim state As String = ""
If filename <> "" Then
   state = "File"
Else
   state = o.GetType().ToString()
End If
otp1.Write(Convert.ToInt32(1), "File", _  System.Text.Encoding.Default.GetBytes("[" + Now.ToString() + "]" + vbCrLf + "AA"), o, filename)
end if
------------------------
for read using OTP-

Private Sub Server1_Connection(ByVal sender As Object, ByVal e As Dart.PowerTCP.Sockets.ConnectionEventArgs) Handles Server1.Connection

Dim oData As ObjectData
otpServer = New Otp(e.Tcp.Stream)
otpServer.DefaultDirectory = Application.StartupPath
Do While e.Tcp.Connected
oData = otpServer.Read()
f = New FileInfo(oData.FileName)
CopyFileInDirectory = Application.StartupPath + "\ReceiveFile" + "\" + f.Name
f.CopyTo(CopyFileInDirectory, True)
f.Delete()
f = Nothing
 Loop
End Sub
OTP take the default pach “C:\”. I have set the new path. But still it cannot copy.
Please advise us if you have any solutions.

Thanks
Nick B (Admin)

From: Utica, NY USA
Posts: 572
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted June 11, 2012 10:07 AM

Hello,

That dll is part of a toolkit we no longer distribute or support, but it sounds like this is related to permissions to the directories you're trying to write to. Is the problem on Windows 7/Vista? Have you tried running your application 'As Administrator' from the right-click context menu? Is using a different location that doesn't require administrator rights an option? (such as a user's directory).

You may want to consider using the .NET Framework's built-in serialization instead of this dll.
rovicohen

From: New York, NY USA
Posts: 24
Member Since: 09/19/05
posted June 11, 2012 10:48 AM

Hello

Thanks for your reply.
I have used XP and win2003 server. Both of the Machines are in "Admin" right.

On same machine, files are successfully copy from one application to another application using OTP.
But on different machine it has a problem. It can't copy the file. It get an error “Access path “c:\” is denied”

Please give your valuable advice. So that we can figure out the issue.

Thanks
Nick B (Admin)

From: Utica, NY USA
Posts: 572
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted June 11, 2012 11:00 AM

Hello,

What line is this exception thrown on?

Please try specifying no path (only the filename) so that the file is written to the application's directory.
rovicohen

From: New York, NY USA
Posts: 24
Member Since: 09/19/05
posted June 11, 2012 11:30 AM

Hello

I get the error when read the file.

Try
  oData = otpServer.Read()
Catch ex As Exception

End Try

Exception type:UnauthorizedAccessException was caught
Exception Message:Access to the path 'C:\abc.jpg' is denied.

I have not used any path. Only used the file name.

Thanks once again
Jamie Powell (Admin)

From: Rome, NY USA
Posts: 377
Member Since: 03/13/07

Extra Support Options
Custom Application Development

posted June 11, 2012 5:02 PM

This dll is no longer offered or supported, since the .NET Framework's Serialization class offers the same functionality.
Reply | General Questions Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX