Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Sending Files


Hi,

I have come back to an old project of mine which is a chat program, I just want to know how do i send a file between the two users?

say

texbox1 has the directory in

commandbutton1 is to send it.

tcpserver will send the file

tcp client will recieve the file

how can I do this?

and the other question is how do I have multipule users on the program? and also know who they are so I can add them to a list?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
2 Questions - Checking Files Size, And Sending Files
1. How do i check the exect size of an exe file? i need it in bytes.

2. Is it possible to send files throught winsock without worring about data that might get lost on the way, and without burden too much on the internet? If not, whats the best way to do it? (I need to transport files from server to multiply clients for program updates).



Thanks ^^

Sending Files To FTP
How can I send a text file to a FTP account if the host was "www.0catch.com" and it required a username and password? Sample code is appreciated.

Sending Files
hey, how would i go about sending a file to another computer by using its ip address?

Sending Files
I was wondering how to send a picture via a messenger... and How would i get it so it would warn them that it is a file not just normal text...and have it underlined blue so that they click on it and then it opens up...?? (I am using winsock)

Sending Files
aight.. i send the file and it works fine.. but if i try to send another file rite after its complete it will only send the first 1 or 2 chunks then stop... i have to reopen the form to send again..can someone figure out y?

heres what im using:


Code:
Private Sub SendNextChunk()
'
Dim hFile As Long
Dim lngChunkSize As Long
Dim strData As String
On Error Resume Next
lngChunkSize = LOF(hFile) + 1 - lngFilePos
'lngChunkSize = LOF(hFile) + 1 - lngFilePos
' If we're not currently connected and transferring, exit. This shouldn't
' happen, but just in case...
If (Not blnTransferring) Then Exit Sub
'
' Open the file that we're sending, for BINARY mode. This means that we can
' read out bits regardless of what's in the file (text, image, music etc..).
hFile = FreeFile
Open strFilename For Binary As #hFile
'
' We need to read the next unsent piece of the file, so move through the
' file past all the bits we've already sent. Then, when we read into
' strData, the data will be the next consecutive bytes.
If (lngFilePos = 0) Then lngFilePos = 1
Seek hFile, lngFilePos
'
' Work out how large this chunk is going to be. Normally, it will be the
' standard CHUNK_SIZE, but if the last piece is less than that, decrease it.
lngChunkSize = LOF(hFile) + 1 - lngFilePos
If (lngChunkSize > CHUNK_SIZE) Then lngChunkSize = CHUNK_SIZE
'
' If the chunksize was 0, it means there's no data left to send, so our
' transfer is complete.
If (lngChunkSize = 0) Then
'
' Send the EOF marker so the remote host knows that's all the data.
strData = "EOF"
blnTransferring = False
Call lstEvents.AddItem("0 bytes, transfer completed. Sending EOF.")

'
' Send the data to the remote host.
Call tcpServer.SendData(strData)
DoEvents
'
Else
'
' Grab the data from the file, and increment our file pointer so that next
' time we read, we are reading the next piece of the file.
strData = String$(lngChunkSize, 0)
Get #hFile, , strData
lngFilePos = lngFilePos + lngChunkSize
'
' Send the data to the remote host.
Call tcpServer.SendData(strData)
Call lstEvents.AddItem("Sent " & lngChunkSize & " bytes")
DoEvents
'
End If
'
Close #hFile
'
End Sub

Sending Files To FTP
I am currently trying to take a file and send it to an ftp. The code I am using looks like it should work, but if any of you know why it isn't, a response would be very beneficial.

itt1.UserName = "jason"
itt1.Password = "bobo1"
itt1.Execute "FTP://65.89.79.75", "DIR /*"
itt1.Execute "FTP://" & ftmtechinfo.txtIP, _
"SEND c:vbjpegcalmdown.jpg /calmdown.jpg"

This FTP allows me to read and write with that login. In addition, if someone could show me the code of how to send a whole folder then, as opposed to just an individual file, I would be ecstatic.

Sending Files To FTP
If I am using an Internet Transfer Control (itt1) and I want to send a file to an FTP, what is the code that I would use?

itt1.execute "FTP://" & ftpaddress, "SEND" ??????

Ftp Sending Files
Hello,

I just started programming Visual Basic (my learning book is almost finished).

I've created a chat application. I have used the WinSock control. Everything works just fine. There is enough help on this control.

Now I'm wonndering if there is a possibility to send and receive files. Does Visual Basic have a control for this? I can't find anything about the subject in the help files.
(I can't be done by the WinSock control I believe).
Is there some kind of ftp control?

Thank in advance,
Dirk

Sending Files To LPT
I need to send some files to printers connected to LPT(1, 2, 3, ...) and COM(1, 2, 3, ...). These printers are not installed in windows, so I can only send the files straight to the ports. I have found some code in the Microsoft Knowledge Base (http://support.microsoft.com/kb/q154078/), but I suppose this only works when the printer is installed in windows. I need some similar code to send raw data to LPT and COM. Or would some API filecopy statement work? As what do I refer to the printer then (source & destination, what to use as destination? LPT1:?).
Thanks for your help here!!!

Kind regards,
Borniet

Sending Files!
Hi! and please dont be mad @ me!
I need to send file from client to server! But i search in google for axemples and thay are realy complicated and hard for me to understand!! So i try to make a simple by myself but it dosn't work! The code is exreamly stupid!
Client

Code:
Private Sub Command1_Click()
Winsock1.SendData App.Path & "code.txt"
End Sub
Private Sub Form_Load()
Winsock1.Connect "213.182.193.12", 1234
End Sub
Private Sub Winsock1_Connect()
MsgBox "connected"
End Sub

And the server:


Code:
Private Sub Form_Activate()
Winsock1.LocalPort = 1234
Winsock1.Listen

End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Winsock1.Close
Winsock1.Accept requestID
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strdata As String
Winsock1.GetData strdata
MsgBox Data
End Sub
i need just to send that txt file to the server! PLease if someone of you can give me wey easy example I will be realy happy ! Thanx!!

Sending Files
i use the following for sending files through a winsock


VB Code:
Public Sub SendFile(sFile As String, sSaveAs As String, tcpCtl As Winsock)On Error GoTo ErrHandler    Dim sSend As String, sBuf As String    Dim ifreefile As Integer    Dim lRead As Long, lLen As Long, lThisRead As Long, lLastRead As Long        ifreefile = FreeFile        ' Open file for binary access:    Open sFile For Binary Access Read As #ifreefile    lLen = LOF(ifreefile)        ' Loop through the file, loading it up in chunks of 64k:    Do While lRead < lLen        lThisRead = 65536        If lThisRead + lRead > lLen Then            lThisRead = lLen - lRead        End If        If Not lThisRead = lLastRead Then            sBuf = Space$(lThisRead)        End If        Get #ifreefile, , sBuf        lRead = lRead + lThisRead        sSend = sSend & sBuf    Loop    lTotal = lLen    Close ifreefile    bSendingFile = True    '// Send the file notification        tcpCtl.SendData "FILE" & sSaveAs    DoEvents    '// Send the file    tcpCtl.SendData sSend    DoEvents    '// Finished    tcpCtl.SendData "FILEEND"    bSendingFile = False    Exit SubErrHandler:    MsgBox "Err " & Err & " : " & Error    'send error data to server Err and ErrorEnd Sub



VB Code:
If data = "FILEEND" Then            bFileArriving = False            Text9.Text = "Saving File to " & sFile            sArriving = sArriving & Left$(msg, Len(msg) - 7)            ifreefile = FreeFile            If Dir(sFile) = ""                Open sFile For Binary Access Write As #ifreefile                Put #ifreefile, 1, sArriving                Close #ifreefile                'ShellExecute 0, vbNullString, sFile, vbNullString, vbNullString, vbNormalFocus            End If                    ElseIf Left$(msg, 4) = "FILE" Then            bFileArriving = True            sFile = Right$(msg, Len(msg) - 4)            sArriving = ""        ElseIf bFileArriving Then            Text9.Text = "Receiving " & bytesTotal & " bytes for " & sFile & "            sArriving = sArriving & msg    End If


but for large files it doesnt work, anyone known of any better ways?

Sending Files
How would I go about sending files over the internet using VB? I have a small chat program type of thing and I want to allow people to send files.

Sending Files
hey all

how would i go about sending files from one comp to another over the internet?

Sending Files To CNC
Hi,
In our company we have an old cnc machine (mill) that needs a text file with program instructions to perform the work.

So far we've been using an old dos based app ProComm to send those files to it.

I'd like to create a VB app that would be able to send those files to our mill machine one at a time.

How would I go about it? Winsock?
Example would be appreciated.

Sending Files
How do you send files over winsock? like a bitmap

Sending Files
I want to make a application like Windows Messenger. But I want
also send files with this program.

1. How can I send messages like Windows Messenger?

2. How can I send Files with this program?

I hope you can help me.

Allready thanks

Sending Files
hello

I 'm sending a binary file using winsock. Everything was hunky doory until the server sent a string to the to client after it sent the file. If I step throught the programs one at a time the string gets there and it works fine. Though when i run it, the sequence of the data seems to go haywire. Is there any way to prevent this from happening?

Any suggestions would help

Sending Files !!!
Hallo Guys

I am very new in VB but I make my first project
it is a winsock program acting as a client and server
(chat program)
i tried it many times on the net and it works so nice
but now i want to add sending file as a new thing in it but i didn't know how to do it
i try to learn
* internet tranfer protocol (HTTP,FTP) but fail to use it to send and recived
* internet comm but failed too

i am dreamd about ake it
browse ==> select file ==> OK ==> the program send a signal to the anthor one ==> the other tell the user there is file coming where he want to save it ==> the other user browse and select new name ==> save ==> the transfere begin and can continue chating during the sending procces

i know i will use commen dialog to open and save but how that all mechanisms work

help guys


!! SORRY FOR MY ENGLISH I HOPE I MAKE IT CLEAR ENOUGH !!

Sending Files Over FTP
Hello all,

I have been trying to find some code that would send files to a server over ftp, but all I can find is expensive DLL files.

Is there a way with Windows API to send files over ftp with defined paramters?

Sending Files
I need to send a different file to each person on a list.

The list will consist of e-mail addresses and each file will start with the first part of that address.

e.g.

1st address = P1111@mydomain.com
1st file = P1111.xls

2nd address = S1234@mydomain.com
2nd file = S1234.xls

etc.

Is there a way to do this with Outlook & VB?

Sending Files
Hey, I have a chat program that I have written recently and I would like to have a send file capability within it. The Chat program uses WinSock and connects to the others IP. Also, if anyone knows how to have one person's font be a differnt color, that would be great.

Sending Files With Winsock Dll
yea i would like to know how to send files with winsock using a server/client application. if ne one could help, please do.

thanks in advance

Sending And Receiving Files...
Im wondering the commands for winsock and other things I need to use for being able to send and recive files...

Kinda like an aim dirrect connection...but with my own program.

Also if you have a basic program already made can I see your code so I can base my code off yours and see how it all works together?

Thanks in advance,

-- Paul

Sending Files By DirectPlay ???
Hi

Can any body give me example for sending files by DirectPlay(From DirectX)

Sending Files Via Winsock Help
im kind of a newb, but if im correct to send a file via winsock would be done like this?


Code:
winsock1.sendata = "C:/somepicture.jpg"

not sure if that is correct, if not could i get help on this? and if yes, then how does the client receive the file so its not in text format and save it to a folder designated for it?


Code:
winsock1_ondataarrival
???

please help?

Dialing And Sending Files.
I have a program, that currently checks for a internet connection, if found, sends files over ftp, if not found, then it creates a new dun, and dials it.

The problem is..... A lot of windows 98/xp/2000 machines are using lan, and LAN overides a phone/modem connection.

So when people try to send, it doesnt create a connection.

The fix is.... run INETWIZ, and select connecting using modem.

Not such a bad problem, but when its 20% of 1000's of people, its big.

Any suggestions on a better way to send files?

I was looking into mscomm, but not sure into how it works.

ALSO, these clients, are dialing into a windows 2000 RAS server

Im really just looking for a better way to establish a connection and send files. And I want it to work on every machine, generic...

Thanks for any help.

Sending Files Question
OK I have a program where I want to send a user files when they click the Get Data command button. I want to send them all of the files in a certain directory and if they have the same named file in their directory I want vb to rename it. All the files in the sending/receiving directory are numbers from 1 onwards. These numbers are checked and stored in a variable called FileNum when the form is loaded. Any ideas on how to go about this would be much appreciated. Thanks. =D

Sending Files Without Any Programs
On download.com I found a really cool application. It claims to be able to send files over a windows 2000 (or NT, I don't really remember) network without the recipient having to download or open any programs.

I did a quick search, but couldn't find anything, but the program says to flash an icon in the system tray when a message or file arrives. I was just wondering if that is possible. It doesn't seem like it because it might pose a huge security risk...

Sending Files To A Vb Application
Hello,

I would like to know how to make my application run a certain file using the OPEN WITH.. in explorer. But I don't want my program to create an instance of itself for every file I open with my application in explorer.. Anyone know?

Thanks!

Sending Files Via Winsock
Hello,

For my client server program that I am using on my home network I have to send a file from the server to the client or vise versa.

I have been looking at the necessay code although it is quite complex.

Please could someone try and explain what this code would be like or where to find it.

I know that I have to use either a binary transfer or winsock control.
Thank you

Sending Files (Winstock)
I'm using DigiRev's Multi-User chat code that can be found here:
http://www.vbforums.com/showthread.php?t=482488

Now i want to send files between users. Is it possible to have a button where i can select a user from lstusers and then click the button to send a file then i can select the file in a browse box and it can show in the chat window the current file that is being sent to what user and show the percent complete?

Sending Files Through Modem
I have a question. Let's say to computers are in different rooms and the both have modems. Is it possible to directly hook these to computers up together? Like phone line to one computer and phoneline to the other computer. I want to do it where it is free and it can send strings to eachother. This way since the modem is able to send and receive data i want it where it can be hoocked directly up to another computer and can send and recieve small files. Is this possible?

Sending Files Through Winsock
Sending files through winsock
---

i really didnt understand how.. i did send text between server - > client
and client - > server

but files i didnt understand how,

Winsock (Sending Files)
Im using the code from CVMichael on this post http://www.vbforums.com/showthread.php?t=377648

to send files from my program to the server program.

The program was setup to send only text files, and i used that program as a patcher to update the client to the newest EXE file when i made one.

Now ive run into another problem.. Right now, all but 1 file are text files, so i was able to do this myself using CVMichael's program to send the 1 file. But i recently found out that my program now has to start sending pictures, and very very soon there will be several pictures being sent through my program so i figured i would change it up so that i would use CVMichael's code instead of mine for all files, but i got a problem..

His files will only send 1 at a time, then you have to do it again. Well i copied all the controls and code from his program and threw it into the forms i already had on my client and server. But its not working. At first only the very first file would send, then i found an error in my code and changed it and now only the last file sends. So i found that error and now NO files will send!!!

Here's my code for sending the files:


Code:
Open App.Path & "ImageList.dat" For Input As #1
Do
Input #1, CurFile
txtFileName.Text = CurFile
Select Case CurFile
Case Is = App.Path & "q.dw"
Label1.Caption = "Updating Basic Questions"
Case Is = App.Path & "JobSpec.dw"
Label1.Caption = "Updating Job Specific Questions"
Case Is = App.Path & "Prod.dw"
Label1.Caption = "Updating Products"
Case Is = App.Path & "ProdPrice.dw"
Label1.Caption = "Updating Prices"
Case Is = Environ("windir") & "systemdw.dat"
Label1.Caption = "Updating Global Settings"
Case Else
Label1.Caption = "Sending Product Images"
End Select
SendFile txtFileName.Text
Loop Until EOF(1)
Close #1
Basically my program will load up, and when the user chooses to update the server, it will load the update form, and throw all the files its going to update into ImageList.dat

Then it will run cmdConnect_Click which contains the code i just posted before this.

If you need any more code let me know, i'll post whatever... This is frustrating!

Winsock - Sending Files
Hey,

I know how to send data using winsock.. but how would I send a file?

Basically I need some way to display a progress indicator (e.g x out of x kb transfered) while sending a file from the client to the server, then the server would save the file in a certain location.

It will be mainly used for pictures so I guess I would need to read the file in binary mode, but I am only used to reading/writing text files using FSO.

Could anyone help me out a little please?

Oh, and I am not sure about this but I read somewhere that I would not be able to send the whole file in one part, I would need to split it - is this true?

Thanks,

Tom

Sending Files Over Winsock
Client connects to server.
sends request to send the file.

server opens the requested file (in binary mode?), loops through it puts it all in a variable (a byte?) then sends it to the client

client receives the byte, opens a new file as binary mode then puts that byte inside it.

Is this how it works?

&lt;RESOLVED&gt;Sending Files To LPT
I need to send some files to printers connected to LPT(1, 2, 3, ...) and COM(1, 2, 3, ...). These printers are not installed in windows, so I can only send the files straight to the ports. I have found some code in the Microsoft Knowledge Base (http://support.microsoft.com/kb/q154078/), but I suppose this only works when the printer is installed in windows. I need some similar code to send raw data to LPT and COM. Or would some API filecopy statement work? As what do I refer to the printer then (source & destination, what to use as destination? LPT1:?).
Thanks for your help here!!!

Kind regards,
Borniet

Help On Sending Files With Winsock.
Hrmmmmm... Here's the deal. I made a connection (using client to server software I programmed) on port 1000 with winsock. I'm trying to make my client send a file to the server. Sending text is simple but sending files is proving more difficult. Can someone give me an example that works for sending files with winsock and explains what is going on? I've seen code before but I can't figure it out because they came with no instructions. I want to understand how to do things and program it myself then, not steal it.

Sending Files To Webserver
OKay.

I have a VB6 program that access several tables in an access database and assembles the info in a fairly large text file.

Now, i need to be able to have the program upload the text file to my website. At this point, i have no idea how to do this and any help wud be appreciated.

Thanks - Matt

Problems Sending Files
i have been messing with winsock to send files, i have it working great when sending files to myself but when i try it with a friend one time it worked then after that i get a runtime error 380, the program was installed aswell. could anybody have a look at it and see if i have done some bad coding.

thank you.
casey.

p.s. the ip can be changed in the connect button and timer1.

Sending BMP Files Through Winsock
hello everyone, i'm making a simple project which will capture the screen of a client computer and then sends this picture to the server. i was thinking of saving the picture first to a bitmap file before sending it. now, is there a better or faster way to do this? thanks in advance..

Sending And Recieving Files
I am working on a program that has to be able to send and recieve files over a network or over the internet, is there a way to add all the people on the network to a listbox? Then be able to select one ( I can put the info from the list into a textbox) and then be able to send them a file? Any help is appreciated. Thanks

-Steve

Sending Datapackets Files Over Tcp ??
Hi guys...... Does anyone of you know how I can send a Datapacket, for example datapacket.dat (Attachment) over TCP to a server.......



Code:
Dim NewLine As Variant
Open "gamepacket.dat" For Input As #1
While Not EOF(1)
Line Input #1, NewLine
Wend
Close #1


I tried that....it sends the data but not the orginal Data Packet...... can anyone help me??

Sending Files[revised]
I am working on a chat/paint program that allows users to send images to each other and be edited in the same program. However, I am not quite sure about the best way to send the picture and how to load it on the other computer.
*I pasted the image to the cliupboard, but I don't know how to send that to the next computer and then load it in the program.

Sending Files In Chunks
I cannot figure out how to do this. Here's the code for my client and server...could someone please edit it to show me how to do it so i can learn from that because i cant figure it out :/

Client code:

Code:
Dim binfiledat As String
Dim lengthof As Long

Open "c:sendthis.exe" For Binary As #1
lengthof = LOF(1)
binfiledat = Space$(lengthof)
Get #1, 1, binfiledat
Close #1

Winsock1.SendData (binfiledat)


Server code:

Code:
dim binfilebuf as string

winsock2(i).getdata info, vbstring
binfilebuf = info

Open "c:
ecievedfile.exe" For Binary As #5
Put #5, , binfilebuf
Close #5
binfilebuf = ""


Thanks in advance,
Twistix.

Sending Files Through Winsock
Here is my client code:


Code:
Dim char2 As String
Dim nextchar As Long
nextchar = 1

Open uploadthis For Binary As #1
Do While nextchar < LOF(1)
char2 = Space$(5000)
Get #1, nextchar, char2
Winsock1.SendData (char2)
nextchar = nextchar + 5000
Loop
Close #1
Timer1.Enabled = False


Here is my server code:


Code:
Open uploadto For Binary As #4
Put #4, , infoo
Close #4


For some reason the uploaded file never turns out the same, i cant figure out why! any help appreciated.

thanks.

Sending Files As Chunks
right now heres my code for sending and recieving files:

client (sending file):

Code:
Dim char As Byte
Dim nextchar As Long
nextchar = 1

Open uploadthis For Binary As #1
Do While nextchar <= LOF(1)
Get #1, nextchar, char
Winsock1.SendData (char)
'MsgBox (char)
nextchar = nextchar + 1
Loop
Close #1
DoEvents
Winsock1.SendData ("finishedupload")



server (recieving file):

Code:
Open uploadto For Binary As #4
Put #4, , infoo
Close #4



Because that sends a file byte by byte it doesnt send large files because its too slow i guess, so how can i send it in chunks of say 5kb? that would fix the problem.

thanks in advance,
twistix.

XMLhttp Sending Files?
Hey all.

I have this problem that I'm trying to solve with web services. I'm trying to get xmlhttp to send an xml file, that has a pdf attached to it. The problem I'm having is that I'm not sure how to go about setting all this up. I set the headers for the xml file and then send it but how do i after this set up the headers for the pdf file and send it. Is it possible to do with xmlhttp?

Thanks for the help.

Sending Files With Winsock
My instant messenger program is working perfectly, but I was wanting to be able to send files with it. Do I have to base64 encode and decode the file to send it that way, or how would I go about it? Security is not an issue, I am behind a firewall

Copyright © 2005-08 www.BigResource.com, All rights reserved