当前位置: 首页>>代码示例>>C#>>正文


C# Sockets.RubyBasicSocket类代码示例

本文整理汇总了C#中IronRuby.StandardLibrary.Sockets.RubyBasicSocket的典型用法代码示例。如果您正苦于以下问题:C# RubyBasicSocket类的具体用法?C# RubyBasicSocket怎么用?C# RubyBasicSocket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RubyBasicSocket类属于IronRuby.StandardLibrary.Sockets命名空间,在下文中一共展示了RubyBasicSocket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Send

        public static int Send(ConversionStorage<int>/*!*/ fixnumCast, ConversionStorage<MutableString>/*!*/ stringCast,
            RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message,
            object flags, object hostNameOrAddress, object port) {
            
            Protocols.CheckSafeLevel(context, 4, "send");
            int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
            SocketFlags sFlags = ConvertToSocketFlag(fixnumCast, context, flags);

            // Convert the parameters
            IPAddress address = (hostNameOrAddress != null) ?
                GetHostAddress(ConvertToHostString(stringCast, context, hostNameOrAddress)) : IPAddress.Loopback;

            EndPoint toEndPoint = new IPEndPoint(address, iPort);
            return self.Socket.SendTo(message.ConvertToBytes(), sFlags, toEndPoint);
        }
开发者ID:tnachen,项目名称:ironruby,代码行数:15,代码来源:UDPSocket.cs

示例2: SetDoNotReverseLookup

 public static void SetDoNotReverseLookup(RubyBasicSocket/*!*/ self, bool value) {
     Protocols.CheckSafeLevel(self.Context, 4);
     self._doNotReverseLookup = value;
 }
开发者ID:jschementi,项目名称:iron,代码行数:4,代码来源:BasicSocket.cs

示例3: Send

 public static int Send(ConversionStorage<int>/*!*/ fixnumCast, 
     RubyBasicSocket/*!*/ self, [DefaultProtocol, NotNull]MutableString/*!*/ message, object flags) {
     Protocols.CheckSafeLevel(fixnumCast.Context, 4, "send");
     SocketFlags socketFlags = ConvertToSocketFlag(fixnumCast, flags);
     return self.Socket.Send(message.ConvertToBytes(), socketFlags);
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:6,代码来源:BasicSocket.cs

示例4: Receive

        public static MutableString Receive(ConversionStorage<int>/*!*/ fixnumCast, RubyBasicSocket/*!*/ self, 
            [DefaultProtocol]int length, [DefaultParameterValue(null)]object flags) {

            SocketFlags sFlags = ConvertToSocketFlag(fixnumCast, flags);

            byte[] buffer = new byte[length];
            int received = self.Socket.Receive(buffer, 0, length, sFlags);

            MutableString str = MutableString.CreateBinary(received);
            str.Append(buffer, 0, received);
            str.IsTainted = true;
            return str;
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:13,代码来源:BasicSocket.cs

示例5: SetSocketOption

        public static void SetSocketOption(ConversionStorage<int>/*!*/ conversionStorage, RubyContext/*!*/ context, 
            RubyBasicSocket/*!*/ self, [DefaultProtocol]int level, [DefaultProtocol]int optname, bool value) {

            Protocols.CheckSafeLevel(context, 2, "setsockopt");
            self.Socket.SetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, value);
        }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:6,代码来源:BasicSocket.cs

示例6: GetSocketOption

 public static MutableString GetSocketOption(ConversionStorage<int>/*!*/ conversionStorage, RubyContext/*!*/ context, 
     RubyBasicSocket/*!*/ self, [DefaultProtocol]int level, [DefaultProtocol]int optname) {
     Protocols.CheckSafeLevel(context, 2, "getsockopt");
     byte[] value = self.Socket.GetSocketOption((SocketOptionLevel)level, (SocketOptionName)optname, 4);
     return MutableString.CreateBinary(value);
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:6,代码来源:BasicSocket.cs

示例7: GetSocketOption

 public static MutableString GetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname) {
     Protocols.CheckSafeLevel(context, 2, "getsockopt");
     int iLevel = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, level));
     int iOptname = Protocols.CastToFixnum(context, Protocols.ConvertToInteger(context, optname));
     byte[] value = self.Socket.GetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, 4);
     return MutableString.CreateBinary(value);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:BasicSocket.cs

示例8: Send

 public static int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags) {
     Protocols.CheckSafeLevel(context, 4, "send");
     SocketFlags socketFlags = ConvertToSocketFlag(context, flags);
     MutableString strMessage = Protocols.CastToString(context, message);
     return self.Socket.Send(strMessage.ConvertToBytes(), socketFlags);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:6,代码来源:BasicSocket.cs

示例9: SetSocketOption

 public static void SetSocketOption(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ level, object/*Numeric*/ optname, bool value) {
     Protocols.CheckSafeLevel(context, 2, "setsockopt");
     int iLevel = Protocols.CastToFixnum(context, level);
     int iOptname = Protocols.CastToFixnum(context, optname);
     self.Socket.SetSocketOption((SocketOptionLevel)iLevel, (SocketOptionName)iOptname, value);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:6,代码来源:BasicSocket.cs

示例10: Shutdown

 public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object/*Numeric*/ how) {
     int iHow = 2;
     if (how != null) {
         iHow = Protocols.CastToFixnum(context, how);
     }
     return Shutdown(context, self, iHow);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:7,代码来源:BasicSocket.cs

示例11: Shutdown

 public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, DefaultParameterValue(2)]int how) {
     CheckSecurity(context, self, "can't shutdown socket");
     if (how < 0 || 2 < how) {
         throw RubyExceptions.CreateArgumentError("`how' should be either 0, 1, 2");
     }
     // TODO: 
     // Webrick's (ruby\1.9.1\webrick\server.rb) use of shutdown on socket leads to subsequent scoket failures. Do close instead.
     // self.Socket.Shutdown((SocketShutdown)how);
     self.Socket.Close();
     return 0;
 }
开发者ID:jschementi,项目名称:iron,代码行数:11,代码来源:BasicSocket.cs

示例12: CloseWrite

 public static void CloseWrite(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self) {
     CheckSecurity(context, self, "can't close socket");
     // TODO: It would be nice to alter the SocketStream to be ReadOnly here
     self.Socket.Shutdown(SocketShutdown.Send);
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:5,代码来源:BasicSocket.cs

示例13: Shutdown

 public static int Shutdown(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, [DefaultProtocol, DefaultParameterValue(2)]int how) {
     CheckSecurity(context, self, "can't shutdown socket");
     if (how < 0 || 2 < how) {
         throw RubyExceptions.CreateArgumentError("`how' should be either 0, 1, 2");
     }
     self.Socket.Shutdown((SocketShutdown)how);
     return 0;
 }
开发者ID:ExpertsInside,项目名称:IronSP,代码行数:8,代码来源:BasicSocket.cs

示例14: Receive

        public static MutableString Receive(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, 
            [DefaultProtocol]int length, [DefaultParameterValue(null)]object flags) {

            SocketFlags sFlags = ConvertToSocketFlag(context, flags);

            byte[] buffer = new byte[length];
            int received = self.Socket.Receive(buffer, 0, length, sFlags);

            MutableString str = MutableString.CreateBinary(received);
            str.Append(buffer, 0, received);
            context.SetObjectTaint(str, true);
            return str;
        }
开发者ID:mscottford,项目名称:ironruby,代码行数:13,代码来源:BasicSocket.cs

示例15: Send

 public static new int Send(RubyContext/*!*/ context, RubyBasicSocket/*!*/ self, object message, object flags, object to) {
     return RubyBasicSocket.Send(context, self, message, flags, to);
 }
开发者ID:mscottford,项目名称:ironruby,代码行数:3,代码来源:UDPSocket.cs


注:本文中的IronRuby.StandardLibrary.Sockets.RubyBasicSocket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。