Jython socket typecasting problems



I try to port a server application to Jython. At the moment I use
Jython21\Lib\socket.py
Currently I do face problems with casting the string "localhost" to the
desired value:
D:\AUT_TEST\workspace\JyFIT>jython fit/JyFitServer2.py localhost 1234
23
['fit/JyFitServer2.py', 'localhost', '1234', '23']
localhost
Traceback (innermost last):
File "fit/JyFitServer2.py", line 146, in ?
File "fit/JyFitServer2.py", line 31, in run
File "fit/JyFitServer2.py", line 96, in establishConnection
File "D:\AUT_TEST\Jython21\Lib\socket.py", line 135, in connect
TypeError: java.net.Socket(): 1st arg can't be coerced to
java.net.InetAddress or String

The cast to Integer for the port does not work either:

D:\AUT_TEST\workspace\JyFIT>jython fit/JyFitServer2.py "" 1234 23
['fit/JyFitServer2.py', '', '1234', '23']

Traceback (innermost last):
File "fit/JyFitServer2.py", line 146, in ?
File "fit/JyFitServer2.py", line 31, in run
File "fit/JyFitServer2.py", line 96, in establishConnection
File "D:\AUT_TEST\Jython21\Lib\socket.py", line 135, in connect
TypeError: java.net.Socket(): 2nd arg can't be coerced to int

This is the code section of my server class (I cut this from a Python
example):
def establishConnection(self):
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect((self.host, self.port))
Do I have to use explicit typecasting? How can this be achieved?

.



Relevant Pages

  • Using IIS 7 to relaying off Yahoo smtp server
    ... server: smtp.mail.yahoo.com. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... command, String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Using IIS 7 to relaying off Yahoo smtp server
    ... smtp outgoing mail server. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... String from) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: Using IIS 7 to relaying off Yahoo smtp server
    ... server: smtp.mail.yahoo.com. ... The following is the port number and the error message returned: ... System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String ... System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, ...
    (microsoft.public.inetserver.iis.smtp_nntp)
  • Re: TCPClient connect slow only on XP Pro ASP on some boxes
    ... most likely you proxy server setting don't exclude localhost. ... > Pertinent .NET console app code. ... > public static string RunTests(string server, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IIS and SBS 2003
    ... I have a new sbs2003 install and if I telnet to localhost ... port 80, and type hhh and hit enter it returns a HTTP/1.1 400 Bad ... "broken" sbs server, it connects but then dumps me. ... If I http to localhost, companyweb or anything I get Cannot Find ...
    (microsoft.public.windows.server.sbs)