Winsock On WinCe

Winsock On WinCe

  • 27 febbraio 2019 alle 2:03 pm #31375

    Ho la necessità di aprire un socket in ascolto o in trasmissione.
    seguendo le informazioni riportate nei manuali creando un ogetto ActiveX ad esempio:

    Dim Socket As MSWinsockLib.Winsock
    Set Socket = CreateObjectLic (“MSWinsock.Winsock.1”, “2c49f800-xxx-xxx-xxx-0080c7e7b78d”)
    If Socket Is Nothing Then Exit Sub
    Socket.Protocol = sckTCPProtocol
    Socket.LocalPort = 1000

    in ambiemte WindowsXP , in simulazione tutto funziona alla perfezione. Se trasferisco il progetto in un HMI con WinCe dove non esiste ActiveX (MSwinsock.ocx) ovviamente non funziona.
    Esiste un modo per poter implementare Winsock per WinCe in VBA ?

  • 28 febbraio 2019 alle 12:43 pm #31396
    Amministratore del forum

    Hi Eros,
    On Windows CE, the Winwrap language does not support the use of external dll, because it does not support the use of the “Declare Function” to declare the functions of the third party dlls.

    For this reason, it is not possible to use the Winsock dll.

    WinCE limitations…

    The only workaround for win CE, that I can see, could be represented by generating an external application, for example in VB.NET, which perform this task.

    The method that you can see here below, replaces the obsolete and no longer supported Winsock (ES_WinSock), which was guaranteed up to Windows XP and not on later operating systems or win CE.

    The reference library that you have to use in the VB script references is the System 2.0.0.

    An example of code to use in a basic script resource is the following but is not for CE….

    ‘#Language “WWB.NET”

    Imports System
    Imports System.Net
    Imports System.Net.Sockets.NetworkStream

    Public Sub Main() Handles .Main

    Dim Client As New System.Net.Sockets.TcpClient
    Dim NetStr As System.Net.Sockets.NetworkStream

    ‘open connection

    NetStr = Client.GetStream()

    ‘If connected …
    If Client.Connected Then
    ‘..check if i can write..
    If NetStr.CanWrite Then
    ‘..convertion of teh message in bytes..
    Dim Bytes() As Byte = System.Text.ASCIIEncoding.ASCII.GetBytes(“Hello”)
    ‘…write on the Stream.
    End If
    End If
    End Sub

    At this point, if you need to read a data it is possible to use the properties CanRead and Read.

    In addition, you can also check out the links:



    Lister – Client – Helper:

    Remaining on Win CE i can’t see an easy workaround….probably is better move on a PC for these tasks

    Kind Regards

  • 28 febbraio 2019 alle 1:52 pm #31399

    I think is a blind corner.

    the statement ‘#Language “WWB.NET” was not accepted if the Platform selected is WinCE.
    with “WWB-COM” (VBA) it’s impossible decalre an external library. (I made one for this pourpose working in WinCE).
    No way.
    I build an executable in C# using .NET Framewok that work perfectly under WinCe.
    How can I send variables to this application every second ?
    It’s the only choice reamain…..

  • 8 marzo 2019 alle 12:33 pm #31515
    Amministratore del forum

    Hi Eros
    Considering the specificity of your request, we recommend to open a ticket in our support channel.
    Please send to the support all the details that you implemented.
    OPC is not an option in your application?
    Kind Regards

    • Questa risposta è stata modificata 1 anno, 2 mesi fa da MODERATOR.
  • 8 marzo 2019 alle 12:47 pm #31518

    Thank’s for your replay.
    I’ll try but seem to be the OPC server cannot run on WinCe platform.
    The solution I have adopted was to open a TCP/IP MODBUS communication on the PLC and to interchange the data from the MOVICON. It seems an efficient solution ….
    Of course with this solution I can not choose the TCP IP port, but it is the minor problem….

    Kind regards.

  • 13 marzo 2019 alle 11:52 am #31524
    Amministratore del forum

    Thanks Eros for your feedback

Devi essere loggato per rispondere a questa discussione.

Topic Tags