#831 FFI Java: Hangs on Socket instantiation

tactics Fri 20 Nov 2009

I'm trying to get some SSL action. I figure the easiest way to do this is through FFI. However, I ran into a strange problem. Fan seems to hang when creating a regular java.net.Socket object.

using [java] java.net
using [java] javax.net.ssl

class SslTest
{
  Void main()
  {
    sock := Socket("www.gmail.com", 80)
  }  
}

tcolar Fri 20 Nov 2009

Does it seem to be the same issue as #692

I don't think it was ever resolved.

brian Sat 21 Nov 2009

I would think that is just a normal Java hang, doubt it has anything to do with FFI. But you never know.

Did you try to do a stack dump to see where it was hung up?

Does it work when you write that code in just Java?

What happens if you try using Fantom's inet API?

fansh> using inet
fansh> s := TcpSocket().connect(IpAddress("www.gmail.com"), 80)
fan.inet.TcpSocket@8c943d1

As an aside, SSL is something where we badly need a Fantom API.

tactics Sat 21 Nov 2009

I would think that is just a normal Java hang, doubt it has anything to do with FFI. But you never know.

It works fine on my Linux lappy now. I'll try a few different things on Monday.

As an aside, SSL is something where we badly need a Fantom API.

This is why I was investigating. Is it something you'd want written in pure Fantom? Or would it suffice to use a native library?

brian Mon 23 Nov 2009

BTW I tried your program on my Windows box and it seems to run fine.

This is why I was investigating. Is it something you'd want written in pure Fantom? Or would it suffice to use a native library?

I definitely want a Fantom API in the core distro for SSL and HTTPS. One of the top missing APIs is a crypto pod with stuff like this.

tactics Mon 23 Nov 2009

I tried it again this morning. It appears to work fine for our local intranet sites, but still hangs on external sites like Google, Yahoo, and Fantom.org. It looks like firewall/proxy configuration issues on my end.

Login or Signup to reply.