View Issue Details

IDProjectCategoryView StatusLast Update
0002157NoesisGUIC++ SDKpublic2021-11-24 16:45
ReporterRyan Assigned Tojsantos  
PrioritynormalSeveritymajor 
Status resolvedResolutionfixed 
Product Version3.1.1 
Target Version3.1Fixed in Version3.1.2 
Summary0002157: Socket library is already initialized on NX
Description

Unfortunately there is no way on NX to discover if the socket library is already initialized or not. We are using a define for that (Socket.inl)

#ifndef NS_DISABLE_SOCKET_INIT
static nn::socket::ConfigDefaultWithMemory SocketConfigWithMemory;
nn::Result r = nn::socket::Initialize(SocketConfigWithMemory);
NS_ASSERT(r.IsSuccess());
r = nn::nifm::Initialize();
NS_ASSERT(r.IsSuccess());
#endif

I suggest to separate profiler function into different library for linking.

PlatformAny

Activities

jsantos

jsantos

2021-10-25 19:32

manager   ~0007534

Even if we separate into a new library we would have the same problem if you are using this profiling library with another 3rdparty middleware that also initializes socket library.

I see two solutions:

  1. Requesting to Nintendo a change in the API. In the other platforms, double initialization of sockets is fine.
  2. Export a callback (in integration API) to initialize sockets. That way, client code is in charge of that.

Does the temporal workaround of using NS_DISABLE_SOCKET_INIT work for you?

Ryan

Ryan

2021-10-26 02:53

reporter   ~0007535

I un-link other 3rd party middleware's network function for now.
However, if we start to implement the network function for our project, I will do NS_DISABLE_SOCKET_INIT.

jsantos

jsantos

2021-10-26 12:00

manager   ~0007537

Last edited: 2021-10-26 12:01

I am checking the latest documentation available on Nintendo website and it read this regarding nn::nifm::Initialize


The network connection management library must be initialized by this function ahead of time before the library's functions can be used,
unless noted otherwise for individual functions. The function also returns an indication of success if the library has been initialized already.

So it gives me the impression they changed the API in the latest version. I need to verify this though.

jsantos

jsantos

2021-11-24 16:45

manager   ~0007608

Last edited: 2021-11-24 16:45

Hi Ryan,

I have checked with the latest Nintendo SDK (13.3.0 and 14.0.0) and it seems they are still aborting when socket is initialized twice. Nintendo is not going to change this behavior. So I think the best solution is just keep using our define NS_DISABLE_SOCKET_INIT (by the way in r10934 I fixed a minor issue about this).

It is also very important that you don't release your game with NS_PROFILE enabled and this macro is intended only for profiling and connecting the Inspector.

I am going to close this, but if you need anything more, please reopen.

Thank you

Issue History

Date Modified Username Field Change
2021-10-25 15:32 Ryan New Issue
2021-10-25 19:29 jsantos Target Version => 3.1
2021-10-25 19:29 jsantos Assigned To => jsantos
2021-10-25 19:29 jsantos Status new => assigned
2021-10-25 19:32 jsantos Note Added: 0007534
2021-10-25 19:32 jsantos Status assigned => feedback
2021-10-26 02:53 Ryan Note Added: 0007535
2021-10-26 02:53 Ryan Status feedback => assigned
2021-10-26 12:00 jsantos Note Added: 0007537
2021-10-26 12:00 jsantos Note Edited: 0007537
2021-10-26 12:01 jsantos Note Edited: 0007537
2021-11-24 16:45 jsantos Status assigned => resolved
2021-11-24 16:45 jsantos Resolution open => fixed
2021-11-24 16:45 jsantos Fixed in Version => 3.1.2
2021-11-24 16:45 jsantos Note Added: 0007608
2021-11-24 16:45 jsantos Note Edited: 0007608