web development India freelance website designer
Description: Want your program to be able to send and get files over the
internet? Well, here you go! This is very easy to understand.

Note: This is a custom control for your applications. This will not properly
get files from the internet or from an ftp. Although the dataarival sub
would be the same, I do not know how the transition would end so I just
sent "xx" and that tells the sub that the transition has ended

'Public declarations
Dim FileOpen as Boolean

Public Function Send_File(FileToSend as string)
'This is the function that sends a file
Dim Temp as String
Dim BlockSize as Long
open filetosend For binary access read as #1 'Open the file to send
BlockSize = 2048 'Set the block size, If needed, set it higher

Do While Not EOF(1)
temp = Space$(blockSize) 'Give temp some space To store the data
Get 1, , temp 'Get first line from file
Winsock1.SendData temp 'Send the data


DoEvents
loop

winsock1.senddata "xx" 'This is a custom control that ends the transmition
close #1
End Function

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim temp As String
Dim data As String
'Check to see if the file is already open

If fileOpen = False Then
Open "c:\somefile_here" For Binary Access Write As #2
fileOpen = True
ElseIf fileOpen = True Then

DoEvents
End If

Winsock1.GetData data 'Get the data
temp = data
'Check to see if it is the end of the transmition

If temp = "xx" Then
Close #2
fileOpen = False
Else
Put 2, , temp 'Store the data to the file
End If
End Sub
Send / Get files using winsock

1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550

Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design