Visual Basic Classic
--
Questions
--
Followers
Top Experts
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
1. Implement the YMODEM protocol yourself, specifications for example at: http://textfiles.planetmirror.com/programming/FORMATS/
2. Buy a commercial library, for example http://www.marshallsoft.com/wsc4vb.htm
3. Try to find a free implementation (couldn't find one myself, but I didn't really look that hard...)
good luck!
mscomm.output = chr$(6)
Do i need to include the carriage return?
Also if the transfer does start how would i write it to a file. with YMODEM you receive files in 128 or 1024 blocks. Thanks very much.
For some reason I never got any OnComm events from mscomm (perhaps I set it up wrong, haven't really used it very much...), so I used a timer instead and checked if MsComm1.InBufferCount > 0
As this was just a quick test I just set up 3 buttons to be able to send ACK (chr(6)) NAK (chr(21)) and "C". I then basiclly followed the following sequence from the YMODEM documentation:
SENDER RECEIVER
C
SOH 00 FF foo.c NUL[123] CRC CRC
ACK
C
SOH 01 FE Data[128] CRC CRC
ACK
SOH 03 FC Data[128] CRC CRC
ACK
SOH 04 FB Data[100] CPMEOF[28] CRC CRC
ACK
EOT
NAK
EOT
ACK
C
SOH 00 FF NUL[128] CRC CRC
ACK
As you see, before you receive the filename you have to send a "C" character to the sender. Also note the 3 extra bytes at the beginning of each block. (SOH is chr(1)), the following two bytes i guess is some kind of sequence number.
This is followed by 128 bytes of data followed by 2 bytes of CRC checksum.
This is the code i used in the timer (just prints the data to a text box)
Dim i As Integer
Dim Inp() As Byte
If MSComm1.InBufferCount <> 0 Then
Inp = MSComm1.Input
For i = 0 To UBound(Inp)
Text1.Text = Text1.Text & Chr(Inp(i)) & " "
Next i
End If
Since you have to save the data to disk you would have to open the file in binary mode an the print each byte with the Put command ( I think it's 'Put' anyway, I don't think I've ever handled binary files in VB :-) )
As you might have noticed it's getting a but late here and I feel like I'm just babbling at the moment so I think I will go to sleep now. I hope that at least something of this makes sence to you :-)
If you need further help, just post again.
Good night!






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
So Far my program can
dial in to the traffic counter
find the files that need to be downloaded
download the files (but not write them to a file)
delete the downloaded files
convert the files to be read in the traffic counting software
disconnect

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Hi! Jonyv and burly411
This is the last 6 days of my internship but I couldn't complete my project.In this project I am expected to write a vb code to provide both text and random file transfer between two PC connected via RS232 cable.I have achieved the text file but failed in file transfer.As much as I understood you wrote such a program .I will be very glad If you can send it to me...
shaktar
shaktar@mynet.com
Visual Basic Classic
--
Questions
--
Followers
Top Experts
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.