elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Ayuda!!! Winsock Transfiere a 8Bytes Por Segundo
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ayuda!!! Winsock Transfiere a 8Bytes Por Segundo  (Leído 1,699 veces)
Rudy21

Desconectado Desconectado

Mensajes: 154


Rudy21 Web Design


Ver Perfil WWW
Ayuda!!! Winsock Transfiere a 8Bytes Por Segundo
« 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


En línea


Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Transfiere la mitad del archivo. [winsock]
Programación C/C++
darckbaston 0 1,246 Último mensaje 1 Julio 2011, 01:42 am
por darckbaston
Ayuda con segundo pc
Redes
Edusoner 2 1,758 Último mensaje 2 Abril 2014, 09:52 am
por Edusoner
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines