Comments (19)
You can just follow a plain C principle if a particular functionality will work in plain C then it most likely that we can wrap it on the managed side without any problems since we can marshal structures or work directly with pointers.
from gamenetworkingsockets.
OK, the plain C interface is all set, I think. Let me know if you see anything missing or awkward.
And I hope to not make any more big API changes for the next release.
If you make some changes in your project, let me know, and I'll add a link in our readme.
from gamenetworkingsockets.
Oh hey, we released 1.0.
from gamenetworkingsockets.
Will do. I probably should have done that before my last major update. I plan on making a version here that matches every major Steamworks SDK release. My next big task is to get this into the Steamworks SDK.
Keeping this issue open until I create the first stable release.
from gamenetworkingsockets.
@fletcherdvalve Any ETA when the initial release will be available?
from gamenetworkingsockets.
For the Steamworks SDK, I'm shooting for a few weeks. So probably a month or so realistically.
from gamenetworkingsockets.
@fletcherdvalve I just wonder, does it make sense to update the C# wrapper right now (people are asking for it) since the code is still subject to change.
By the way, can you please provide a function in the flat interface for releasing networking message using this pointer? So we will be able to feed it to a function on the managed side.
from gamenetworkingsockets.
Yes, I am trying to avoid making any more big changes to the API until the first release, which should have an API very similar to this. So if you want to target that release, I think you could start with this, and you won't waste much work.
The biggest changes to the API were:
- Abstracting SteamID to a generic identity thing.
- IPv6 support.
I will make a function to release a message that has plain C linkage. Is that what you are asking? My long term plan for this is to allow the app to create a message, and pass it to the API when sending a message, and we could avoid copying the payload. I am not sure that is important in managed code or not.
To be honest, I don't understand managed code very well, so I don't really know the best way to support your efforts, which I appreciate. So just tell me what you think would be best. In particular, the callbacks I think are still a bit of a mess. What is the standard way to dispatch callbacks, and is there a better interface that I could provide that would make it more natural to do things in the standard C# way.
from gamenetworkingsockets.
I will make a function to release a message that has plain C linkage. Is that what you are asking?
Yes, because right now we can't release received messages.
My long term plan for this is to allow the app to create a message, and pass it to the API when sending a message, and we could avoid copying the payload. I am not sure that is important in managed code or not.
That would be great. This is what ENet provides with NoAllocate
flag, so we can track using the callback when a packet is being destroyed in order to release memory with a payload.
To be honest, I don't understand managed code very well, so I don't really know the best way to support your efforts, which I appreciate. So just tell me what you think would be best. In particular, the callbacks I think are still a bit of a mess. What is the standard way to dispatch callbacks, and is there a better interface that I could provide that would make it more natural to do things in the standard C# way.
In general, the current approach is quite convenient to work with I would say. But if you are looking for improving usability and so on then I would recommend you to look at this fork of ENet which we are maintaining primarily for C#.
from gamenetworkingsockets.
What functions do I need to provide for dealing with SteamNetworkingIPAddr and SteamNetworkingIdentity? Do I basically need to take all of the inline functions at the bottom of steamnetworkingtypes.h and provide plain C versions of them?
from gamenetworkingsockets.
Do I basically need to take all of the inline functions at the bottom of steamnetworkingtypes.h and provide plain C versions of them?
Yes, this is a quite traditional way of wrapping an encapsulated functionality, so we will be able to feed a marshaled structure on the managed side with those unions and other data to it.
from gamenetworkingsockets.
@fletcherdvalve I almost finished updating the wrapper, so far I found only one thing: SteamNetConnectionInfo_t
structure still has outdated m_unIPRemote
and m_unPortRemote
fields, I believe that there should be SteamNetworkingIPAddr
instead with the union of addresses.
from gamenetworkingsockets.
@nxrighthere Ah yes, I haven't fixed that yet, but I'll do that now.
from gamenetworkingsockets.
@fletcherdvalve When I'm trying to bind the socket to ::0
using SteamAPI_SteamNetworkingIPAddr_SetIPv6
on the server the following error occurs: Debug - Type: 2, Message: Cannot create listen socket. Failed to bind socket. Error code 0x00002741.
from gamenetworkingsockets.
What is the actual call that is failing?
And are you selecting a port? ::0 is a valid IP to bind to (interpreted as "any interface"). But a port is required, so you'd need to bind to [::0]:port.
from gamenetworkingsockets.
This is the correct thing to do in C++:
SteamNetworkingIPAddr serverLocalAddr;
serverLocalAddr.Clear();
serverLocalAddr.m_port = nPort;
m_hListenSock = m_pInterface->CreateListenSocketIP( serverLocalAddr );
from gamenetworkingsockets.
Hm, I'll bet that you must have supplied a port, because you would have gotten a more specific error message, generated by this code:
bool CSteamNetworkListenSocketDirectUDP::BInit( const SteamNetworkingIPAddr &localAddr, SteamDatagramErrMsg &errMsg )
{
Assert( m_pSock == nullptr );
if ( localAddr.m_port == 0 )
{
V_strcpy_safe( errMsg, "Must specify local port." );
return false;
}
from gamenetworkingsockets.
Oh, I'm a bit incorrectly encoded the address into a byte array. Now it works fine. Thanks.
from gamenetworkingsockets.
@fletcherdvalve The wrapper updated to the latest version. Cheers.
from gamenetworkingsockets.
Related Issues (20)
- Building fails on Archlinux with error HOT 3
- thread sanitizer detects issues HOT 4
- valgrind: Conditional jump or move depends on uninitialised value HOT 6
- lets move to zpp::bits!? HOT 2
- Steps to build for iOS and Android
- VCPKG / Building x86-windows-static
- Where/Who to contact for console access HOT 1
- cs2 and csgo ping HOT 1
- Early Retry Mechanism for SteamNetworkingSockets Authentication HOT 9
- Build fails to succeed for Windows / Visual Studio HOT 1
- Request to add compression
- minbase_decls.h always defines DLL_EXPORT on Windows (issues with static pthread)
- Build fails with clang 16 from non utf-8 garbage character
- Q: Performance warning
- Segmentation fault on CreateListenSocketIP using WSL2 Ubuntu
- Fail to build in windows 10 x64 due to openssl HOT 2
- Install with libsodium
- Unable to establish P2P with ICE
- test_p2p client failing
- Inaccuracy in the message sending function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gamenetworkingsockets.