User Tag List

Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 34

Thread: DarkSocket - raw networking sockets, like MooSock

  1. #1
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    2,052
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)

    DarkSocket - raw networking sockets, like MooSock

    DarkSocket object
    DarkSocket is a powerful socket extension, capable of creating sockets in several ways.
    The basic functionality has a choice of TCP, UDP and ICMP (pinging), which gives a total of 6 methods of using the object (server & client).
    Or for advanced users, use different actions, and gain access to over ten thousand possible methods of using the object.
    A total of 28 protocols, 29 different address families, and 5 different socket types are supported.
    The extension is multithreaded so your program will not halt during any operations - you can have up to 256 sockets open at once, if your hardware is capable enough.

    Download includes a HTTP connecting example.

    Conditions:
    On error:
    When an error occurs in the extension.
    On new status:
    (For debug) When the extension has a new status.
    Client returned message: (number Socket ID (use -1 for any socket))
    When a client socket has received a message, this condition will trigger. The message can be accessed with LastMessageText$().
    On socket done:
    When a socket has finished, this condition should trigger.*

    Actions:
    Client > Basic initialise: (string Hostname, number Port, string Protocol, string Initial text)
    The first parameter (Hostname) is the hostname to connect to, the second (Port) is the port to connect on, the third (Protocol) is the protocol to use. The basic mode is limited to "TCP", "UDP", and "ICMP". Once a connection has been established, the text in the fourth parameter (Initial text) is sent to the server.
    Client > Advanced initialise: (string Hostname, number Port, string Protocol, string Address family, string Socket type, string Initial text)
    Advanced: Do not use unless you know what you are doing.
    The first parameter (Hostname) is the hostname to connect to, the second (Port) is the port to connect on, the third (Protocol) is the protocol to use (IPPROTO_***).
    The fourth parameter is the address family (AF_***), and the fifth is the socket type (SOCK_***).
    Once a connection has been established, the text in the final parameter (Initial text) is sent to the server.
    Some values for the parameters are given here.
    Client > Shutdown socket: (number Socket ID)
    The parameter (Socket ID) contains the socket ID that is to be shut down.
    Client > Go independent: (number Socket ID)
    The parameter (Socket ID) contains the socket ID that should go independent. This means it no longer scans for messages from MMF2, and should not be used under normal circumstances.
    Client > Set to receive only: (number Socket ID)
    The parameter (Socket ID) contains the socket ID that should be set to receive-only. This shuts down the sending part of the socket, generally not used.
    Client > Send text to server: (number Socket ID, string Text to send)
    The first parameter (Socket ID) contains the socket ID that will send the message, the second (Text to send) contains the text to be sent.
    Client > Link socket output to file: (number Socket ID, string File to link to)
    The first parameter (Socket ID) contains the socket ID that will send the message, the second (File to link to) contains the file that the message should be appended to. This is useful for keeping a log. To undo, see the next action
    Client > Unlink socket output: (number Socket ID)
    The first parameter (Socket ID) contains the socket ID that should disable linking. It undos the previous action.
    Client > MMF2 reports on/off: (number Socket ID, bool On or off)
    The first parameter (Socket ID) contains the socket ID that will have the reports (messages received conditions) disabled or enabled. The second parameter should be 1 or 0, and sets whether the socket reporting is enabled or disabled. If disabled, "Client > On received message" condition will not be ran by the socket. This will report an warning (but not an error) if there is no file linked to the socket, as that means you will have no idea what the socket is doing.

    The server actions have not been implemented.

    Expressions:
    Error$ (bool Clear)
    The errors (if any) that have been generated. Use 1 for the parameter (Clear) to erase the current errors. Use with On Error condition.
    Report$ (bool Clear)
    The reports (if any) that have been generated. Use 1 for the parameter (Clear) to erase the current reports. Use with On Report condition.
    LastMessageSocketID
    The Socket ID that received a message. Use with Client > On message condition.
    LastMessageText$
    The last message that was received. Use with Client > On message condition.
    LastMessageAddress
    The memory address of the last message that was received. Use with Client > On message condition.
    LastMessageSize
    The size of the last message that was received, in bytes. Use with Client > On message condition.
    NewSocketID
    The most recently started socket's ID.
    GetSocketIDForLastEvent
    The socket ID that ran the "Socket done" condition.

    Please note this isn't the exact format that the final version will take. Any deprecated actions/conditions/expressions will run a popup message requesting you replace them.

    Click the title of the object to download.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleMac Export ModuleSWF Export ModuleUnicode Add-on
    Pharanygitis's Avatar
    Join Date
    Aug 2006
    Location
    Germany
    Posts
    1,037
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Prerelease] DarkSocket

    This is very very great! Thank you very much! cool..

  3. #3
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    2,052
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)

    Re: [Prerelease] DarkSocket

    Pre v1.1 update:
    • CPU usage improved.
    • Bug that caused some connections to not report messages fixed.
    • Example moved from requesting Google's icon to Google's index page.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator ProPatch Maker
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    DJFuego's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    1,438
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: [Prerelease] DarkSocket

    Example Links?

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [Prerelease] DarkSocket

    Quote Originally Posted by SortaCore
    Download includes a HTTP connecting example.

  6. #6
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    2,052
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    Just a note that there has been issues loading this object under Windows 7. I don't possess the knowledge to isolate it so I would appreciate it if someone could run Depends.exe on the extension and isolate missing dependencies.

    Next update will include servers, and from the look of things I'm going to have to extend the object considerably more to allow IPv6, since bind() is kicking up a fuss.

  7. #7
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SortaCore
    The extension is multithreaded so your program will not halt during any operations - you can have up to 256 sockets open at once, if your hardware is capable enough.
    As someone who has been working with the MMF2 runtime and networking for a good few years, this sets alarm bells ringing over here.

    The runtime is not thread safe, so short of having some kind of custom message queue (as earlier Lacewing builds did), I'm wondering how you're managing to safely spin off blocking I/O without causing big performance or stability issues.

    The correct way to do networking with MMF is through the use of I/O Completion Ports. Anything else (especially multithreading) is likely to suffer badly in terms of performance, stability or, most likely, both.

  8. #8
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    2,052
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jamie View Post
    The runtime is not thread safe, so short of having some kind of custom message queue (as earlier Lacewing builds did), I'm wondering how you're managing to safely spin off blocking I/O without causing big performance or stability issues.
    Thanks for the input, Jamie, I appreciate it
    Yep, DarkSocket uses two message queues (MMF2->threads and threads->MMF2) and a Extension:: read/write lock for threadsafe operations.

    I'm not sure about the I/O blocking problems, I have the extension use the ioctlsocket() function to set all the sockets to non-blocking by default. All testing has been on the main 3 protocols, (TCP, UDP, ICMP) thus far, and no error thrown that non-blocking isn't permitted. However, before I made the change to have the ioctlsocket() call the extension did abuse the CPU usage.

    Quote Originally Posted by Jamie View Post
    The correct way to do networking with MMF is through the use of I/O Completion Ports. Anything else (especially multithreading) is likely to suffer badly in terms of performance, stability or, most likely, both.
    I'll look into moving to I/O Completion Ports, but workload has gone high again, so a release will not be for a while.
    Also, it's not clear whether that has limitations on the choice of protocols the sockets can use, and it seems to be relatively undocumented.

    For the update-watchers:
    Next update includes the ability to create servers, and the ability to form packets. An ICMP example will be included.
    Due to the new packet-forming functionality, the extension has moved from using string variables for packets to raw memory copying. I have to double-check all the memory-related functions before I release, although that doesn't meant there won't be any memory leaks.

  9. #9
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SortaCore
    it's not clear whether that has limitations on the choice of protocols the sockets can use
    It's a low-level I/O pattern, not a protocol implementation.

  10. #10
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    Phi's Avatar
    Join Date
    Jan 2010
    Location
    England
    Posts
    2,052
    Mentioned
    25 Post(s)
    Tagged
    0 Thread(s)
    Excellent, I'll see about implementing it

Page 1 of 4 1 2 3 ... LastLast

Similar Threads

  1. Sockets in MooSock ?
    By Rushino in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st June 2020, 06:19 AM
  2. Simple raw sockets?
    By Gibbon in forum Lacewing
    Replies: 1
    Last Post: 30th May 2014, 08:08 PM
  3. Replies: 2
    Last Post: 26th November 2013, 08:16 PM
  4. Networking Help
    By Game_Master in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 11th January 2008, 03:34 AM
  5. Networking help
    By Skeets in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 6th August 2007, 12:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •