[IronPython] Access to Enumeration Values

Anthony Tarlano mailinglist.account at gmail.com
Thu Aug 4 18:12:28 CEST 2005


the namespace System.Net.Sockets contains an enumation type named
SocketOptionName for retrieving Socket options. It's definition is:

public enum SocketOptionName
{
      // Fields
      AcceptConnection = 2,
      AddMembership = 12,
      AddSourceMembership = 15,
      BlockSource = 0x11,
      Broadcast = 0x20,
      BsdUrgent = 2,
      ChecksumCoverage = 20,
      Debug = 1,
      DontFragment = 14,
      DontLinger = -129,
      DontRoute = 0x10,
      DropMembership = 13,
      DropSourceMembership = 0x10,
      Error = 0x1007,
      ExclusiveAddressUse = -5,
      Expedited = 2,
      HeaderIncluded = 2,
      HopLimit = 0x15,
      IPOptions = 1,
      IpTimeToLive = 4,
      IPv6ProtectionLevel = 0x17,
      KeepAlive = 8,
      Linger = 0x80,
      MaxConnections = 0x7fffffff,
      MulticastInterface = 9,
      MulticastLoopback = 11,
      MulticastTimeToLive = 10,
      NoChecksum = 1,
      NoDelay = 1,
      OutOfBandInline = 0x100,
      PacketInformation = 0x13,
      ReceiveBuffer = 0x1002,
      ReceiveLowWater = 0x1004,
      ReceiveTimeout = 0x1006,
      ReuseAddress = 4,
      SendBuffer = 0x1001,
      SendLowWater = 0x1003,
      SendTimeout = 0x1005,
      Type = 0x1008,
      TypeOfService = 3,
      UnblockSource = 0x12,
      UpdateAcceptContext = 0x700b,
      UpdateConnectContext = 0x7010,
      UseLoopback = 0x40
}

Upon accessing an enumeration value by name IronPython only returns
its name as a string... If this isn't a bug then it should be... see
this output

IronPython 0.9.2036 on .NET 2.0.50215.44
Copyright (c) Microsoft Corporation. All rights reserved.
>>> from System.Net.Sockets import SocketOptionName
>>> SocketOptionName
<type 'System.Net.Sockets.SocketOptionName'>
>>> SocketOptionName.MaxConnections
MaxConnections
>>> SocketOptionName.MaxConnections.value__
2147483647
>>>

Anthony



More information about the Ironpython-users mailing list