/// <summary> /// Creates a interface endpoint. /// </summary> /// <value>NetworkInterfaceEndPoint</value> public unsafe int CreateInterfaceEndPoint(NetworkEndPoint address, out NetworkInterfaceEndPoint endpoint) { var slice = m_LocalAndTempEndpoint.AtIndexAsSlice(0, (uint)Binding.Baselib_RegisteredNetwork_Endpoint_MaxSize); var error = default(ErrorState); endpoint = default(NetworkInterfaceEndPoint); NetworkEndpoint local; local = Binding.Baselib_RegisteredNetwork_Endpoint_Create( (Binding.Baselib_NetworkAddress *) & address.rawNetworkAddress, slice, &error); if (error.code != ErrorCode.Success) { return((int)error.code); } endpoint.dataLength = (int)local.slice.size; fixed(void *ptr = endpoint.data) { UnsafeUtility.MemCpy(ptr, (void *)local.slice.data, endpoint.dataLength); } return((int)Error.StatusCode.Success); }
public NetworkRequest GetRequestFromHandle(int handle) { return(new NetworkRequest { payload = m_PayloadArray.AtIndexAsSlice(handle, m_PayloadSize), remoteEndpoint = new NetworkEndpoint { slice = m_EndpointArray.AtIndexAsSlice(handle, (uint)Binding.Baselib_RegisteredNetwork_Endpoint_MaxSize) } }); }
public unsafe NetworkInterfaceEndPoint CreateInterfaceEndPoint(NetworkEndPoint address) { var slice = m_LocalAndTempEndpoint.AtIndexAsSlice(0, (uint)Binding.Baselib_RegisteredNetwork_Endpoint_MaxSize); var error = default(ErrorState); NetworkEndpoint local; local = Binding.Baselib_RegisteredNetwork_Endpoint_Create( (Binding.Baselib_NetworkAddress *) & address.rawNetworkAddress, slice, error.NativeErrorStatePtr ); if (error.ErrorCode != ErrorCode.Success) { return(default(NetworkInterfaceEndPoint)); } var endpoint = default(NetworkInterfaceEndPoint); endpoint.dataLength = (int)local.slice.size; UnsafeUtility.MemCpy(endpoint.data, (void *)local.slice.data, endpoint.dataLength); return(endpoint); }