GithubHelp home page GithubHelp logo

nikouu / mgba-lua-socket Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 138 KB

Small project to understand how the mGBA implementation of lua sockets works.

License: MIT License

C# 28.53% Lua 71.47%
lua lua-script mgba csharp dotnet socket

mgba-lua-socket's Introduction

mGBA lua Socket

Small project to understand how the mGBA implementation of lua sockets works and how to connect to it. This is pretty much entirely based off the work mGBA scripts source code folder.

The end goal is to send a message to mGBA via sockets.

How to run

  1. See my mGBA-lua-HelloWorld repository for basic setup instructions.
  2. Ensure you're running a ROM in mGBA.
  3. Load socketserver.lua
  4. Open SocketClient.sln for the manual C# socket client.
  5. Run/debug SocketClient

Protocol issues?

  • While I'm not awfully familiar with low level sockets and TCP, it seems the code from the mGBA repo doesn't respond with an ACK automatically on a recieve and as such trips up applications sending requests - such as Postman, which stays in an endless connecting state.
  • I've added an ACK manually
  • I've added logging points

See below for comparisons between the .NET client in the repo and Postman.

Client Result
Custom .NET
Postman HTTP
Postman Websocket

It seems the socket error that comes up is the AGAIN one. However, I'm unsure what this means, and reading the mGBA C source doesn't help me understand either. Just don't know enough low level TCP ๐Ÿคทโ€โ™€๏ธ (yet).

Notes

  • Even after manually adding in a response via sock:send("<|ACK|>") seems to also not work and gives a Error: Parse Error: Expected HTTP/ error:

  • I assume there would be a way to make the code protocol compliant such that Postman and other clients can easily connect. However, for the time being, I'm just happy with the C# code working.
  • SocketTest.lua is leftover from the copy over from mGBA. It's not used here, but it was used for inspiration to help understand.

mgba-lua-socket's People

Contributors

nikouu avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.