1. Do you need support for Assetto Corsa Competizione? Please use the proper forum below and ALWAYS zip and attach the WHOLE "Logs" folder in your c:\users\*youruser*\AppData\Local\AC2\Saved. The "AppData" folder is hidden by default, check "Hidden items" in your Windows view properties. If you report a crash, ALWAYS zip and attach the WHOLE "Crashes" folder in the same directory. Do not post "I have the same issue" in an existing thread with a game crash, always open your own thread. Do not PM developers and staff members for personal troubleshooting and support.
  2. As part of our continuous maintenance and improvements to Assetto Corsa Competizione we will be releasing small updates on a regular basis during the esports season which might not go through the usual announcement process detailing the changes until a later version update where these changes will be listed retrospectively.
  3. If ACC doesn't start with an error or the executable is missing, please add your entire Steam directory to the exceptions in your antivirus software, run a Steam integrity check or reinstall the game altogether. Make sure you add the User/Documents/Assetto Corsa Competizione folder to your antivirus/Defender exceptions and exclude it from any file sharing app (GDrive, OneDrive or Dropbox)! The Corsair iCue software is also known to conflict with Input Device initialization, if the game does not start up and you have such devices, please try disabling the iCue software and try again. [file:unknown] [line: 95] secure crt: invalid error is a sign of antivirus interference, while [Pak chunk signing mismatch on chunk] indicates a corrupted installation that requires game file verification.
  4. When reporting an issue with saved games, please always zip and attach your entire User/Documents/Assetto Corsa Competizione/Savegame folder, along with the logs and the crash folder (when reporting related to a crash).

Let's talk about broadcasting (programmer's thread)

Discussion in 'ACC General Discussions' started by Minolin, Dec 12, 2018.

  1. Minolin

    Minolin Staff Member KS Dev Team

    Please have a look at the WriteString() method in the sample, you'll need an equivalent for both prefixing the size and converting to UTF8.
     
  2. leosntone

    leosntone Rookie

    Code:
    public static void writeByte(ByteArrayOutputStream os , String s) throws Exception{
            byte[] temp = s.getBytes("utf-8");
            os.write((short)temp.length);
            os.write(temp);
        }
    java no unsigned integer. only short is 2 byte but signed.
     
  3. Minolin

    Minolin Staff Member KS Dev Team

    If you are sure your value is > 0, you can pass the signed one.

    There are for sure correct bit shifting solutuions out there, but this makes me think of moving everything to int32. There are no big pakets anymore, size won't hurt
     
  4. leosntone

    leosntone Rookie

    REGISTER_COMMAND_APPLICATION = 1
    BROADCASTING_PROTOCOL_VERSION =2
    displayName = name
    connectionPassword=12345
    msRealtimeUpdateInterval=100
    commandPassword=12345

    byte[] = [1, 2, 4, 110, 97, 109, 101, 5, 49, 50, 51, 52, 53, 100, 5, 49, 50, 51, 52, 53]
     
  5. Minolin

    Minolin Staff Member KS Dev Team

    right.. it should be

    1, 2, 4, 0, 110, 97, 109, 101, 5, 0, 49, 50, 51, 52, 53, 100, 0, 0, 0, 5, 0, 49, 50, 51, 52, 53

    So for some reason your string size descriptor is 1 byte instead of a short (I absolutely don't see why).
    And the os.write(100); seems to write a byte instead of int32 as well. Given the surprising platform difficulties I'd like to add this is expected in little endian.
     
  6. leosntone

    leosntone Rookie

    thank you for reply me.

    java byte[] result is [1, 2, 4, 110, 97, 109, 101, 5, 49, 50, 51, 52, 53, 100, 5, 49, 50, 51, 52, 53]
    C# is 1,2,4,0,110,97,109,101,5,0,49,50,51,52,53,100,0,0,0,5,0,49,50,51,52,53,
    so
    Code:
    ByteArrayOutputStream os = new ByteArrayOutputStream();
            os.write((byte)1);
            os.write((byte)2);
            writeByte(os,"name");
            writeByte(os,"12345");
            os.write(100);
            os.write(0);
            os.write(0);
            os.write(0);
            writeByte(os,"12345");
            byte[] bytes = os.toByteArray();
    Code:
    public static void writeByte(ByteArrayOutputStream os , String s) throws Exception{
            byte[] temp = s.getBytes("utf-8");
            os.write((short)temp.length);
            os.write(0);
            os.write(temp);
        }
    it works. i can receive data. :p
     
  7. Minolin

    Minolin Staff Member KS Dev Team

    ya but that won't help much, I figure you'll see the same mismatches on the receiving side.
    *very* surprised about java here, in multiple perspectives
     
  8. leosntone

    leosntone Rookie

    just like, int16 is 2 byte, so br.write(ushort) needs two positions , it is [4, 0] if bw.Write(Convert.ToUInt16(bytes.Length));
    bw.Write(100), int32 is 4 byte, so it is [100,0,0,0] .
    Very strange. :p
     
  9. ZioYuri78

    ZioYuri78 Hardcore Simmer

    Finally i'm back to code, i figured out how to connect and receive data with UE4, the strange thing is that i can't get the "local" socket port until i send data at least once, i supposed that once you have created a socket you was ok on gather the port, btw the solution it's pretty easy and i get it after the first time i send data with the "request connection" like this:

    Code:
    .
    .
    SenderSocket->SendTo(Message.GetData(), Message.Num(), BytesSent, *RemoteAddr);
    
    SenderLocalPort = SenderSocket->GetPortNo();
    .
    .
    
    now i can start write all the structures and all the remaining stuff.
     
    TDS likes this.
  10. ZioYuri78

    ZioYuri78 Hardcore Simmer

    Now i can read and write strings (from FString to UTF8 and viceversa), now the road is all downhill (or at least until the next bug) :)
    Code Snippets below (class, variables and functions names are subject to change..maybe..) :

    Code:
    void AUDPSenderReceiver::WriteString(FArrayWriter &Buffer, const FString &String)
    {
        int16 SLength = String.Len();
        ANSICHAR *UTF8String = TCHAR_TO_UTF8(*String);
        
        Buffer << SLength;
        for (char *p = UTF8String; p < UTF8String + SLength; ++p)
        {
            Buffer << *p;
        }
    }
    
    Code:
    void AUDPSenderReceiver::ReadString(const FArrayReaderPtr &Buffer, FString &String)
    {
        int16 SLength = 0;
        uint8 SChar = 0;
    
        *Buffer << SLength;
    
        for (int i = 0; i < SLength; ++i)
        {
            *Buffer << SChar;
            String.AppendChar(SChar);
        }
    }
    
     
    TDS likes this.
  11. ZioYuri78

    ZioYuri78 Hardcore Simmer

    Hey @Minolin , which is the correct way to unregister/disconnect a client? I tried send a request with the UNREGISTER_COMMAND_APPLICATION and BROADCAST_PROTOCOL_VERSION like this (UE4 C++)
    Code:
    void AUDPSenderReceiver::ACCDRequestDisconnection()
    {
        FArrayWriter Message;
        uint8 CommandType = (uint8)EOutboundMessageTypes::UNREGISTER_COMMAND_APPLICATION;
        uint8 ProtocolVersion = (uint8)EBNProtocol::BROADCAST_PROTOCOL_VERSION;
    
        Message << CommandType;
        Message << ProtocolVersion;
    
        int32 BytesSent = 0;
        SenderSocket->SendTo(Message.GetData(), Message.Num(), BytesSent, *RemoteAddr);
    
        CheckByteSent(BytesSent);
    
    }
    
    but it doesn't work, maybe i need to also send the ConnectionId?
     
    TDS likes this.
  12. leosntone

    leosntone Rookie

    now it does not work at 0.6 ???
     
  13. sps_for_race

    sps_for_race Alien

    Check the changelog:
    https://www.assettocorsa.net/forum/index.php?threads/update-0-6-mp-ratings-rebooted.55050/


     
  14. leosntone

    leosntone Rookie

    now, 1.0 released. but when i connected game, it show this error massege "Your broadcasting control app is outdated".
    I use source code compilation which in release game.
     
  15. ZioYuri78

    ZioYuri78 Hardcore Simmer

    Yeah, is still the old client.
     
  16. leosntone

    leosntone Rookie

    but i use Testclient/ksBroadcastingTestClient.exe it works fine. o_O
     
  17. ZioYuri78

    ZioYuri78 Hardcore Simmer

    Maybe @Minolin uploaded the right compiled client but the old source code :D
     
  18. Minolin

    Minolin Staff Member KS Dev Team

    ya looks like that, sorry :-/ let me fish the first 200 tasks on my list and I'll try to upload the current sources
     
  19. Can someone provide an overview of the changes of the udp interface with the new update (1.1)?
     
  20. Minolin

    Minolin Staff Member KS Dev Team

    no changes, C# sample in the steam folder should be up to date
     
    Ensi Ferrum likes this.
Similar Threads
Forum Title Date
ACC Hardware Discussions Giving back for ACC 1.8: Let's talk about multi-class, multi-hour, full grid simulation? Dec 10, 2021
ACC Physics Let's talk about spins... Apr 2, 2021
ACC PS4/PS5/XB1/XBX/S General Discussions Let's talk multiplayer/online servers Jul 11, 2020
ACC General Discussions Let's talk about broadcasting (user's thread) Dec 12, 2018
Console Lounge Let's talk vote to kick Mar 18, 2017
Console Lounge Quick race weekend (let's talk abou it Vol.1) Feb 24, 2017
Chit Chat Room Let's talk Lotus 98T Feb 17, 2017
Console Lounge Porsche Cayman GT4 - Let's talk gearing Jan 16, 2017
Console Lounge Let's talk about rage quitters... Dec 9, 2016
Chit Chat Room 935/78 - Let's talk setup and driving Oct 30, 2016
Console Lounge Let's talk about braking Oct 6, 2016
Suggestions Let's talk weather (I am not asking for rain). Aug 15, 2016
Chit Chat Room Let's talk wheels...again. why not? Aug 27, 2014
ACC PS4/PS5/XB1/XBX/S General Discussions Let's hope this does the trick Dec 16, 2022
ACC PS4/PS5/XB1/XBX/S General Discussions Let's do something, this is going to get ugly...(Servers) Aug 3, 2020

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice