Creating a new instance of Winsock in a Class Module 
Author Message
 Creating a new instance of Winsock in a Class Module

Someone knows how to create a new instance of Winsock in a Class Module.
without using the visual environement.

I wrote this code:

Option Explicit
Private e_socket As Winsock
Private DatiLetti As String

Property Get Data_arrival() As String
   Data_arrival = DatiLetti
End Property
Public Sub e_connect()
  While e_socket.State <> sckConnected
      If e_socket.State <> sckConnecting Then
         With e_socket
            .RemoteHost = "xx.x.x.xx"
            .RemotePort = 1234
            .Connect
         End With
      End If
   Wend
End Sub

Public Sub e_disconnect()
   If e_socket.State = sckConnected Then
      e_socket.Close
   End If
End Sub

Public Sub e_send(DataToSend As String)
   e_socket.SendData DataToSend + Chr$(13) + Chr$(10)
End Sub

Private Sub e_socket_DataArrival(ByVal bytesTotal As Long)
   Dim strData As String
   e_socket.GetData strData, vbString
   DatiLetti = DatiLetti + strData
End Sub

Private Sub Class_Initialize()
   Set e_socket = new winsock        THIS STATEMENT DOESN'T WORK !!!!
End Sub

thanks in advance.
best regards Pietro



Sun, 22 Jul 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Using New to create instances of a class in MTS componant

2. Using New to create instances of a class in MTS componant

3. How to create Winsock Control in class modules

4. Instances of custom class modules

5. Instancing Class Module

6. instance of class module can't see own type

7. handle a excel/word instance in a class module

8. The size of a class module instance

9. Memory required for a class module instance

10. handle a excel/word instance in a class module

11. class module, instancing attribute multiUse or SingleUse?

12. Dim obj As New Class crt Dim Obj As Class = New Class

 

 
Powered by phpBB® Forum Software