public int Recv(Lua.CharPtr data, int count, int flag) { if (tcpSocket != null) { byte[] arr = new byte[count]; try { #if !NETFX_CORE int read = tcpSocket.Read(ref arr); data.setByteArray(arr); return(read); #else //TODO: #endif } catch (Exception e) { //Tools.LogException("pSocket", e); } } /*else if(tcpSocketChannel != null) * { * byte[] arr = new byte[count]; * try * { * int read = 0; * read = tcpSocketChannel.read(ByteBuffer.wrap(arr)); * data.setByteArray(arr); * return read; * } * catch (Exception e) * { * Tools.LogException("pSocket", e); * } * } * else if(tcpSocketAndroid != null) * { * tcpSocketAndroid.Recv(data, count, null); * }*/ return(0); }
public override void Write(byte[] array, int offset, int count) { try { Lua.CharPtr ptr = new Lua.CharPtr(); ptr.setByteArray(array); if (type == 0) { Log.i("LuaLogStream", ptr.toString()); } else { Log.e("LuaLogStream", ptr.toString()); } } catch (Exception e) { Log.d("LuaLogStream.cs", e.Message); } }