Título: Ayuda!!! Winsock Transfiere a 8Bytes Por Segundo Publicado por: Rudy21 en 8 Octubre 2009, 10:58 am Pues Estoy Haciendo Un Programa Cliente/Servidor
Que Envia Una Imagen Por WinSock (uso CSocketMaster) pero el problema que tengo es que ENVIA A 8bytes por SEGUNDO!!!!!!! alguien me puede ayudar y decirme xq? aqui dejo el codigo, El que envia tiene un MODULO para convertir Imagen BMP a JPG pero ese no lo adjunto el codigo, xq de ahi funciona perfecto ya intente COPILANDOLOS y DESDE VB6, La conexion la hago el que ENVIA desde una Maquina Virtual, de hecho intenté en la misma maquina, es decir SIN LA VIRUTAL y me transfiere = a 8Bytes por segundo, de hecho despues de intentarlo varias veces AHORA ME TRANSFIERE a 4bytesporsegundo tmb lo intente TODO (enviar y recibir) desde la maquina virtual y el mismor resultado DEMASIADO LENTO!! alguna idea? Recibe: Código: Dim WithEvents WS1 As CSocketMaster Dim Imagen() As Byte Dim Flag As Boolean Dim Tamaño As Long Dim lBytes As Long Private Sub Command1_Click() WS1.CloseSck WS1.Listen End Sub Private Sub Form_Load() Set WS1 = New CSocketMaster WS1.LocalPort = 6969 WS1.CloseSck WS1.Listen End Sub Private Sub Timer1_Timer() Label1.Caption = WS1.State End Sub Private Sub WS1_ConnectionRequest(ByVal requestID As Long) WS1.CloseSck WS1.Accept requestID End Sub Private Sub WS1_DataArrival(ByVal bytesTotal As Long) If Flag = False Then WS1.GetData datos, vbLong Tamaño = datos Open "C:\Captura.jpg" For Binary Access Write As #1 Flag = True End If If Flag Then lBytes = lBytes + bytesTotal Label2.Caption = lBytes WS1.GetData Imagen Put #1, , Imagen If lBytes >= Tamaño Then Close #1 Flag = False Image1.Picture = LoadPicture("C:\Captura.jpg") lBytes = 0 End If End If End Sub Envia: Código: Dim WithEvents WS1 As CSocketMaster Dim Imagen() As Byte Private Sub Form_Load() Set WS1 = New CSocketMaster WS1.RemoteHost = "HACK01" WS1.RemotePort = 6969 WS1.CloseSck WS1.Connect End Sub Private Sub Timer1_Timer() Label1.Caption = WS1.State End Sub Private Sub Timer2_Timer() Set Picture1.Picture = CaptureScreen() SavePicture Picture1.Picture, App.Path & "\TmpBmp.bmp" BMPtoJPG App.Path & "\TmpBmp.bmp", App.Path & "\TmpPic.jpg" If WS1.State = sckConnected Then Enviar_Imagen End If End Sub Private Sub WS1_CloseSck() WS1.CloseSck WS1.Connect End Sub Private Function Enviar_Imagen() WS1.SendData FileLen(App.Path & "\TmpPic.jpg") Open App.Path & "\TmpPic.jpg" For Binary Access Read As #1 Get #1, , Imagen Close #1 WS1.SendData Imagen End Function |