Link to home
Start Free TrialLog in
Avatar of ksboyz
ksboyz

asked on

Send jpg file using the winsock TCP/IP

halo all,...
i got serious problem with sending file across the network using the TCP.
The files are actually jpg or Bmp...
i've tried to source from the internet,...but a lot of them are send text / string wihich is not capable to send the jpg /bmp...
i would like to know how to receive and send  a binary files / jpg / bmp file thru TCP
pls show some important codes on the Client and the server program..thanks


from
ksboy
Avatar of Xwave
Xwave

HI !
I have found this source (sorry it is in french.. but it's work very fine !)
Look here: http://www.vbfrance.com/article.aspx?ID=4056
++
Avatar of ksboyz

ASKER

hi,
eh,...i have try out the program,...it's still have some distortions on bmp file,...and totally failed on the jpg file.....the jpg file became corrupted.....

any other way??? i have found out some vb programs which able to send / receive binary file without corruption...
but too bad they nvr provide the source codes.... :(
help me,... : (

from
ksboy
Have you tried this example already?

http://www.freevbcode.com/ShowCode.Asp?ID=988
Avatar of ksboyz

ASKER

tried already,....still having problem of sending the jpg file....

from ksboy
It really depends on how your server/client is set up.

Basically...

Dim intFile as Integer
intFile = FreeFile()

Dim bArray() as Byte
Open "file.jpg" For Binary as intFile
ReDim bArray(LOF(intFile))
Get intFile, 1, bArray
Close intFile

wskServer.SendData bArray()


then on the client side DataArrival event...

(again this depends on your setup)

Dim bArray() as Byte
wskClient.GetData bArray, vbByte + vbArray

Dim intFile as Integer
intFile = FreeFile

Open "file.jpg" For Binary as intFile
Put intFile, 1, bArray
Close intFile

Avatar of DanRollins
ksboyz, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
Avatar of SpazMODic
SpazMODic

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial