Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all, I am trying to call Java SSL within a C program via JNI. The constraints/requirements are: 1) The socket is created inside the C program. Bound to a port but no accept() has been called yet. 2) The socket descriptor is passed via the JNI 3) Java code will create a SSLServerSocket type socket based on this descriptor. (ideally resuse the existing on created in C instead of creating additional socket using same descrptor) Does anyone know how 3) can be done? Thanks,
Post Follow-up to this messageThanh wrote: > Hi all, > > I am trying to call Java SSL within a C program via JNI. The > constraints/requirements are: > > 1) The socket is created inside the C program. Bound to a port but no > accept() has been called yet. > 2) The socket descriptor is passed via the JNI > 3) Java code will create a SSLServerSocket type socket based on this > descriptor. (ideally resuse the existing on created in C instead of > creating additional socket using same descrptor) > > Does anyone know how 3) can be done? > > > > Thanks, > Descriptors have no meaning outside the OS. Similiar to a pointer.
Post Follow-up to this messageI guess you are saying there's no way. But I saw SocketImpl has a private field called 'fd'. Can't I do something to set it to the one created in the C code? If so, how to set it? and how to associate this SocketImpl object to the SSLServerSocket? kjc wrote: > Thanh wrote: no this > Descriptors have no meaning outside the OS. > Similiar to a pointer.
Post Follow-up to this messageThanh wrote: > I guess you are saying there's no way. But I saw SocketImpl has a > private field called 'fd'. Can't I do something to set it to the one > created in the C code? If so, how to set it? and how to associate this > SocketImpl object to the SSLServerSocket? > > > kjc wrote: > > > no > > > this > > > You'll have an int value for the fd, but, it will mean nothing to the OS on the machine that is attemping the connection. Since it was not allocated on that machine. I don't understand why you really need to do this. What it sounds like you want to do is pass in the port number via JNI.
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.