Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WINSOCK HELP!!!!

Status
Not open for further replies.

DJTN

Programmer
Jul 5, 2000
121
US
I have written a chat app using winsock with tcp protocol. I have no problems transfering text back and forth between the two apps.
I have Two picture boxs on the form (image1 and image2) in the image one box you can load a picture from your hard drive into it. I want the user to be able to send that picture to image2 on the other users app. I have tried everything. When I try to send the pictures like I did the text I get errors, cant find file, object needed. I'm not sure but I think I'm sending the file but I cant parse it from the strings. I dunno I could be wrong, anyway , if someone has the almighty answer I would greatly appreciate it.

Thanx,
Todd [sig]<p>Todd Norris<br><a href=mailto:Todd.Norris@home.com>Todd.Norris@home.com</a><br><a href= Personal Profile 2000</a><br>Hope this helps ![/sig]
 
I remember reading something similar on one of these forums - the long and short of it (I think) was that you cannot send files using the winsock control. The suggested answer was to send the files using ftp, which has its own problems, but this is no good for you!

Simon [sig][/sig]
 
you may have more lucking the Inet Transfer control, and using an Asynchronous connection, according to the MSDN documentation on it you can actually download pictures into a picture box, etc, by defining the type of information comming in. Its called Microsoft Internet Transfer Control 6.0

here is a couple code sniplet, of data being received in as Text ( I have a Data viewer, that brings in information returned from an ASP in realtime )

[tt]
to start the transfer
Inet1.Cancel
Inet1.AccessType = icDirect
Inet1.Protocol = icHTTP
Inet1.URL = vNewValue
Inet1.Execute


Grabing the information (using the StateChanged event)
Private Sub Inet1_StateChanged(ByVal State As Integer)
Select Case State
Case 12 Or 8 'Is Receiving a Response, or Response has been Received completely
Dim vtData As Variant ' Data variable.
Dim strData As String: strData = &quot;&quot;
Dim bDone As Boolean: bDone = False

' Get first chunk.
vtData = Inet1.GetChunk(1024, icString)
DoEvents
Do While Not bDone 'loop until all data been downloaded
strData = strData & vtData
DoEvents
' Get next chunk.
vtData = Inet1.GetChunk(1024, icString)
If Len(vtData) = 0 Then
bDone = True
End If
[red] strData is the data received thus far, I've cut out my own code as it's not revelent to see anyways[/red]
Loop
End Select
End Sub
[/tt]

hopefully this helps you get some ideas on other alternative methods. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top