dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/System/Platform SocketMethods.cs,1.1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System/Platform SocketMethods.cs,1.1,1.2
Date: Thu, 03 Apr 2003 00:40:46 -0500

Update of /cvsroot/dotgnu-pnet/pnetlib/System/Platform
In directory subversions:/tmp/cvs-serv30313/System/Platform

Modified Files:
        SocketMethods.cs 
Log Message:


Re-implement "NetworkStream" and "Socket".


Index: SocketMethods.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System/Platform/SocketMethods.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** SocketMethods.cs    20 Nov 2002 23:45:29 -0000      1.1
--- SocketMethods.cs    3 Apr 2003 05:40:44 -0000       1.2
***************
*** 24,30 ****
--- 24,36 ----
  using System;
  using System.Runtime.CompilerServices;
+ using System.Threading;
  
  internal class SocketMethods
  {
+ 
+       // Get the invalid socket handle.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static IntPtr GetInvalidHandle();
+ 
        // Create a socket and obtain a socket descriptor (return true on 
success).
        [MethodImpl(MethodImplOptions.InternalCall)]
***************
*** 78,85 ****
        // Unused entries are replaced with IntPtr.Zero.  Returns the number
        // of descriptors that fired, 0 on timeout, or -1 on error.  The
!       // timeout is in ticks (100 nanosecond intervals).
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static int Select(IntPtr[] readarray, IntPtr[] 
writearray, IntPtr[] errorarray, long timeout);
  
        // Get the last-occurring system error code for the current thread.
        [MethodImpl(MethodImplOptions.InternalCall)]
--- 84,134 ----
        // Unused entries are replaced with IntPtr.Zero.  Returns the number
        // of descriptors that fired, 0 on timeout, or -1 on error.  The
!       // timeout is in microseconds.
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static int Select(IntPtr[] readarray, IntPtr[] 
writearray, IntPtr[] errorarray, long timeout);
  
+       // Change the blocking mode on a socket.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool SetBlocking(IntPtr handle, bool blocking);
+ 
+       // Get the number of available bytes on a socket.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static int GetAvailable(IntPtr handle);
+ 
+       // Get the name of the local end-point on a socket.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool GetSockName(IntPtr handle, out long address,
+                                                                               
  out int port);
+ 
+       // Set a numeric or boolean socket option.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool SetSocketOption
+                       (IntPtr handle, int level, int name, int value);
+ 
+       // Get a numeric or boolean socket option.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool GetSocketOption
+                       (IntPtr handle, int level, int name, out int value);
+ 
+       // Set the linger socket option.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool SetLingerOption
+                       (IntPtr handle, bool enabled, int seconds);
+ 
+       // Get the linger socket option.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool GetLingerOption
+                       (IntPtr handle, out bool enabled, out int seconds);
+ 
+       // Set a multicast socket option.  TODO: ipv6
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool SetMulticastOption
+                       (IntPtr handle, int name, long group, long mcint);
+ 
+       // Get a multicast socket option.  TODO: ipv6
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool GetMulticastOption
+                       (IntPtr handle, int name, out long group, out long 
mcint);
+ 
        // Get the last-occurring system error code for the current thread.
        [MethodImpl(MethodImplOptions.InternalCall)]
***************
*** 90,93 ****
--- 139,163 ----
        [MethodImpl(MethodImplOptions.InternalCall)]
        extern public static String GetErrnoMessage(Errno errno);
+ 
+       // Determine if we can start threads on this system.  Needed because
+       // "Thread.CanStartThreads" is not accessible from this assembly.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool CanStartThreads();
+ 
+       // Make a backdoor call to "ThreadPool.QueueCompletionItem", to get
+       // around the problem that it is not accessible from this assembly
+       // via a direct method invocation.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static bool QueueCompletionItem
+                       (AsyncCallback callback, IAsyncResult state);
+ 
+       // Create a "ManualResetEvent" instance.  Backdoor access.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static WaitHandle CreateManualResetEvent();
+ 
+       // Perform a "Set" on a "WaitHandle" instance that is assumed to
+       // be a "ManualResetEvent".  Backdoor access needed in ECMA mode.
+       [MethodImpl(MethodImplOptions.InternalCall)]
+       extern public static void WaitHandleSet(WaitHandle waitHandle);
  
  }; // class SocketMethods





reply via email to

[Prev in Thread] Current Thread [Next in Thread]