Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Create custom socket
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,


Report this thread to moderator Post Follow-up to this message
Old Post
Thanh
04-06-05 05:27 PM


Re: Create custom socket
Thanh 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.

Report this thread to moderator Post Follow-up to this message
Old Post
kjc
04-06-05 05:27 PM


Re: Create custom socket
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:
> Thanh wrote: 
no 
this 
> Descriptors have no meaning outside the OS.
> Similiar to a pointer.


Report this thread to moderator Post Follow-up to this message
Old Post
Thanh
04-06-05 05:27 PM


Re: Create custom socket
Thanh 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.

Report this thread to moderator Post Follow-up to this message
Old Post
kjc
04-06-05 05:27 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Security archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:58 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.