|
-
Sep 2nd, 2010, 10:13 AM
#1
Thread Starter
New Member
Serial Communication File Transfer Issue
Hi,
Right now I am working with vb6.0 application in which I am using SaxComm control for serial communication (RS232 protocol).
I am using the following code for file download in SaxComm receive event.
SaxComm1.XferPath = "..\src"
SaxComm1.Download = True
File is successfully downloading into the mentioned directory.
When ever I am receiving a file,I am getting file transfer dialog box which is showing the file transfer and its closing once file transfer is complete.
Here my requirement is it possible to find out programmatically whether the file transfer completed or not??
Is there any other way to read the file stream programmatically other than using saxcomm control???
Thanks in advance
-
Sep 2nd, 2010, 10:50 AM
#2
Fanatic Member
Re: Serial Communication File Transfer Issue
Hi,
You can download XMCommCRC.ocx from my homepage (www.hardandsoftware.net). It provides only XMODEM file transfers, but this may be all that you need. It has a file TransferStatus event, which provides transfer status messages.
Using SaxComm, you can use the CommEvent event TransferStatus to determine success or failure.
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 3rd, 2010, 06:48 AM
#3
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
In the SaxComm control receive event and also in the form unload, I just kept a message box and try to find the value of CommEvent.
I am getting value 2 in the receive event and 100 in the form unload.
actually my requirement is when ever file comes to the receive buffer it should download automatically.
That is why I kept the SaxComm1.Download=True in the receive event.
In which area I need to check for CommEvent value to know whether file transfer completed or not and what are the values it contains for success or failue.
Depending upon completion of file transfer I need to do some other work further.
How to resolve this??? Can you please help me in this.
Thanks for your reply.
-
Sep 3rd, 2010, 11:09 AM
#4
Fanatic Member
Re: Serial Communication File Transfer Issue
Hi,
Download = True only works for ZModem file transfers, not for any other. What file transfer protocol are you using? Naturally, the other side has to try to start the transfer. Someone (somewhere) has to take control. I prefer that something at the application level actually starts the transfer, instead of assuming that something at the other end will do so -- though this may work fine, if both sides of the conversation agree about everything.
CommEvent = 2 is simply that for a ReceiveData packet. CommEvent = 100 means that a transfer has started. These two CommEvent values are valid in the OnComm event subroutine. You will want to use the FileTransfer event, and use the FinishFile and FinishFileTransfer event. These events fires when the transfer has completed (assuming success). The Abort...Event fire if the transfer fails or is aborted.
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 4th, 2010, 06:25 AM
#5
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
Thanks for your information.FinishFileTransfer event is sufficient for me to do my task.
Actually I am facing one more issue with file transfer is, after completion of the file transfer,the file is not with same name and with same extension.It is saving with name "True" and with out any file extension.
Is it possible to get the file as it is with name and extension???
If so how to do that???
-
Sep 4th, 2010, 06:30 AM
#6
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
I am using Zmodem protocol.This is just for your information.
-
Sep 4th, 2010, 11:04 AM
#7
Fanatic Member
Re: Serial Communication File Transfer Issue
I haven't noticed this. I presume that you are using ZModem? The transfer does include the filename that it furnished by the sending side, so the only thing that I can imagine is that it may have been changed there.
What I do with other file transfer types is to send the actuall filename "out of band," so that I can use that filename when creating the receive file.
Dick
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 4th, 2010, 11:18 AM
#8
Fanatic Member
Re: Serial Communication File Transfer Issue
BTW, I see that you said that you are using Zmodem. So, cancel that part of my reply.
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 6th, 2010, 01:48 AM
#9
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
Can you please tell me the solution to the received file issue????Is there anyway to get the file with exact name and with extension????
-
Sep 6th, 2010, 04:46 AM
#10
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
I tried with all the protocols.But only ZModem protocol is working for me in receiving file.With remaining protocols file transfer not happening.
I just try to use the property "XferDestFilename" also this time and given the destination file name.
Here is my code what I kept in SaxComm receive event.
SaxComm1.XferProtocol = Protocol_ZModem
SaxComm1.XferPath = "D:\\Socket Projects\\src"
SaxComm1.XferDestFilename = "Dest.xls"
SaxComm1.Download = True
But still after completion of file transfer ,the file is always with name "True" and it is not having any extension.
Any suggestions to resolve my problem from your end????
-
Sep 6th, 2010, 11:14 PM
#11
Fanatic Member
Re: Serial Communication File Transfer Issue
The path that you are using is unusual. Have you tried to a local folder? Have you tried it without specifying XferDestFilename (Zmodem sets the file name to that of the sender, by default). I am mystified by the fact that you say that the filename is True, which (it seems to me) would indicate that the code fragment that you posted isn't an accurate representation. The filename is a string. It is hard to imaging that it would get converted to True, which should be a boolean, though even then I cannot imagine what has happened.
I haven't use SaxComm Objects for several years, but I've never had the trouble that you report. When I get back to my main machine, I'll look at the SaxComm example code that I have in my book (Visual Basic Programmer's Guide to Serial Communications 4 which works correctly for ZModem transfers) to see if I can suggest the solution.
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Sep 7th, 2010, 08:27 AM
#12
Thread Starter
New Member
Re: Serial Communication File Transfer Issue
Hi Dick,
After I am given some file name in the Download property my issue is resolved.
XferDestFilename is not working.
-
Sep 7th, 2010, 10:26 AM
#13
Fanatic Member
Re: Serial Communication File Transfer Issue
If I recall, XferDestFilename will be set to the filename that has been set by SaxComm (after the file transfer has started). Though, perhaps I misremember.
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|