Modifying spidermonkey

Due to responses on one of my previous queries, I have decided to look into TCP hole punching. I have looked through jme networking source code, and it looks ultra complicated. What file/where in that file would I modify the ServerSocket to be used? What code would I modify to change how it generated the client’s Socket? Is it possable to change how the server uses .accept() without a massive modification of the API?

Sure it’s possible. I have zero idea on what you need to change, though, so it’s tough to comment beyond that.

But anyway, everything in Spider Monkey is really modular. The Network convenience class is just that, a convenience class. You can pass your own sockets and adapters to it and stuff.

…just have to find the right layer to inject into.

Have you ever done hole punching before? I think step 1 is probably to get that working outside of spider monkey so you can post what that code looks like. Plus if you never manage to get that working then the rest of the discussion is immaterial.

Why would hole punching require modifying the spider monkey code? Doesn’t it just tell the router to forward the port to the right IP?

You mean UPnp? UDP hole punching just throws a few packets, and hopes that a normal router will route the backwards packes the same way. (as it is connection less this is a best effort thing)