[IronPython] (no subject)

Процышин Дмитрий foxpdll at comch.ru
Wed Sep 15 08:16:11 CEST 2004

salamaleikum all

had this

from System 			import *
from System.IO          	import *
from System.Net.Sockets		import *
from System.Text.Encoding.ASCII	import *

print "initializing server..."
listener = TcpListener(8080)
print "server initialized, waiting for"+"incoming connections..."
s = listener.AcceptSocket()
ns = NetworkStream(s)
r = StreamReader(ns)
while 1:
	command = r.ReadLine()
	if not command:
	print "incoming: ", command 
	result = "foxpdll"
	res = GetBytes(result.ToCharArray())
	print type(res)

at s.Send(res,res.Length,0) program terninate
with error
Unhandled Exception: System.Exception: bad args to this method <method# Send on System.Net.Sockets.Socket>
   at IronPython.Objects.ReflectedMethodBase.Call(Object[] args)
   at IronPython.Objects.Ops.Call(Object func, Object arg0, Object arg1, Object arg2)
   at __main__.init() in E:\tmp\IronPython-0.6\bin\fox.py:line 21
   at IronPythonConsole.IronPython.DoFile(String[] args)
   at IronPythonConsole.IronPython.Main(String[] args)

the type of res is System.Byte[]
why it fails? what wrong i am doing?
what kind of parameters must be send to s.Send function? in msdn it is a byte array
iznt syste.byte[] not byte array????????

More information about the Ironpython-users mailing list