B
Brad
So I have this C++ library I've written that is required to interface
with Visual Basic and Java as well as be plugged into an existing C++
application. Visual Basic wasn't that big of a deal, just a quick
little VB wrapper and everything is great. C++, obviously, not a
problem. The library functions perfectly -- PERFECTLY -- when called
up from those two languages.
Java, however...
I wrote a JNI wrapper to wrap up and serve my library to Java. Most of
the functionality of my library works just fine through JNI, except
for one critical piece. I try to make a socket connection to a server
from inside a call in the library at one point and my call to C++'s
standard connect() function just...hangs. It sits there. It doesn't
time out, it doesn't return, it just . . . hangs. I have no idea why.
No error codes, no exceptions, no core dump. Nope. Just hangs. Like I
said, it works just fine in C++ and in VB. But JNI seems to be working
strangely with it.
Maybe if I provide a little more information on that architecture of
my library, someone can help me out. What happens is this: The user
initializes a call to my library and makes a request. The request to
the library returns some data to the user and, right before the
request returns the data, a thread is split off in the library. This
thread is a monitoring thread and needs to communicate with a server.
The thread examines the request that was made and attempts a
connection with the server.
So, I'm wondering, is there something I'm missing with threading and
JNI?
Thanks
with Visual Basic and Java as well as be plugged into an existing C++
application. Visual Basic wasn't that big of a deal, just a quick
little VB wrapper and everything is great. C++, obviously, not a
problem. The library functions perfectly -- PERFECTLY -- when called
up from those two languages.
Java, however...
I wrote a JNI wrapper to wrap up and serve my library to Java. Most of
the functionality of my library works just fine through JNI, except
for one critical piece. I try to make a socket connection to a server
from inside a call in the library at one point and my call to C++'s
standard connect() function just...hangs. It sits there. It doesn't
time out, it doesn't return, it just . . . hangs. I have no idea why.
No error codes, no exceptions, no core dump. Nope. Just hangs. Like I
said, it works just fine in C++ and in VB. But JNI seems to be working
strangely with it.
Maybe if I provide a little more information on that architecture of
my library, someone can help me out. What happens is this: The user
initializes a call to my library and makes a request. The request to
the library returns some data to the user and, right before the
request returns the data, a thread is split off in the library. This
thread is a monitoring thread and needs to communicate with a server.
The thread examines the request that was made and attempts a
connection with the server.
So, I'm wondering, is there something I'm missing with threading and
JNI?
Thanks