Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / April 2005

Tip: Looking for answers? Try searching our database.

Create custom socket

Thread view: 
Thanh - 05 Apr 2005 23:05 GMT
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,
kjc - 06 Apr 2005 00:45 GMT
> Hi all,
>
[quoted text clipped - 11 lines]
>
> Thanks,

Descriptors have no meaning outside the OS.
Similiar to a pointer.
Thanh - 06 Apr 2005 02:41 GMT
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?

> > Hi all,
> >
[quoted text clipped - 14 lines]
> Descriptors have no meaning outside the OS.
> Similiar to a pointer.
kjc - 06 Apr 2005 02:58 GMT
> 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
[quoted text clipped - 25 lines]
>>Descriptors have no meaning outside the OS.
>>Similiar to a pointer.

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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.