public int Send_internal(byte[] buf, int offset, int count, SocketFlags flags, out int error) { error = 0; int ret = 0; if (jSocket == null || !jSocket.isConnected()) { error = 10057; //WSAENOTCONN (Socket is not connected) return(ret); } try { jSocket.getOutputStream().write(vmw.common.TypeUtils.ToSByteArray(buf), offset, count); ret = count; } catch (Exception e) { error = 10054; //WSAECONNRESET (Connection reset by peer) ret = 0; #if DEBUG Console.WriteLine("Caught exception during Send_internal - {0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace); #endif } return(ret); }
private Socket(rtl.SOCKET handle) #endif { fHandle = handle; #if cooper fSocketInput = fHandle.getInputStream(); fSocketOutput = fHandle.getOutputStream(); #endif }
public void Connect(EndPoint remoteEP) { var lEndPoint = (IPEndPoint)remoteEP; #if cooper var lAddress = java.net.InetAddress.getByAddress(lEndPoint.Address.GetAddressBytes()); fHandle = new java.net.Socket(lAddress, lEndPoint.Port); fSocketInput = fHandle.getInputStream(); fSocketOutput = fHandle.getOutputStream(); #else void *lPointer; int lSize; #if posix || toffee || darwin || android rtl.__struct_sockaddr_in lIPv4; rtl.__struct_sockaddr_in6 lIPv6; #if posix && !darwin && !android rtl.__CONST_SOCKADDR_ARG lSockAddr; #else rtl.__struct_sockaddr lSockAddr; #endif #else rtl.SOCKADDR_IN lIPv4; sockaddr_in6 lIPv6; #endif IPEndPointToNative(lEndPoint, out lIPv4, out lIPv6, out lPointer, out lSize); var lRes = 0; #if posix && !darwin && !android lSockAddr.__sockaddr__ = (rtl.__struct_sockaddr *)lPointer; lRes = rtl.connect(fHandle, lSockAddr, lSize); #elif toffee || darwin || android lRes = rtl.connect(fHandle, (rtl.__struct_sockaddr *)lPointer, lSize); #else lRes = rtl.connect(fHandle, lPointer, lSize); #endif if (lRes != 0) { throw new Exception("Error connecting socket"); } #endif Connected = true; }
private Socket(java.net.Socket handle) { fHandle = handle; fSocketInput = fHandle.getInputStream(); fSocketOutput = fHandle.getOutputStream(); }