Hi,
There is a Java (SUN 1.4) server which using Object Input/Output Streams at
SSL/Socket to communicate with Java clients.
Now there is a request for making C# Client for this server also.
SSL layer could be done with Org.Mentalis.Se curity.dll from seclib-1.0
Mentalis package - its fine...
But, threre is a problem:
How to properly communicate from C# language to Java.ObjectInpu tStream -
cause I've tried many times, and always get the Java exception about wrong
stream header.
I've tought about using such code:
....
Connection = new SecureSocket(Ad dressFamily.Int erNetwork,
SocketType.Stre am, ProtocolType.Tc p, options);
Connection.Conn ect(new IPEndPoint(Dns. Resolve(server) .AddressList[0],
int.Parse(port) ));
Send("GET_SERVE R_VERSION.CSHAR P.SSL.MENTALIS\ r\n", "UNKNOWN HEADER");
....
protected void Send(string data, Header header) {
System.IO.Memor yStream memOut = new System.IO.Memor yStream();
System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er formatter =
new System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er();
formatter.Seria lize(memOut, data, header);
byte[] toSend = memOut.ToArray( );
int sent = Connection.Send (toSend);
while(sent != toSend.Length)
{
sent += Connection.Send (toSend, sent, toSend.Length - sent,
SocketFlags.Non e);
}
}
....
- but I've no idea how to make proper header value - that would work...
So, the question is:
How to make proper conversation with Java Object Streams from C# language...
....receiving objects is also needed...
My data objects from/to java server usually are strings, int, longs, bytes,
dates, arrays and multidimensiona l arrays of its...
Do you have any ideas or advices for me ?
Regards,
Chris 2 8774
Hi Krzysztof,
Adding to the email I sent you I found such information on the mentalis pages:
The .NET class library offers SSL support when you connect to an HTTP server, but unfortunately it does not offer SSL or TLS support for other Internet protocols.
I am not sure how it relates to non-http socket connections to your java server.
I am not an expert on SSL/TSL but did an implementation of SSL/TSL using OpenSSL library written in C++ and wrote a C# .Net wrapper. This worked with http or email (POP3/SMTP) servers for secure connections.
I suppose there is a problem with headers while negotiating SSL/TSL connection. Did you try non-secure connections between your C# and Java code? Give it a go and if it works, then try the OpenSSL. I might try to help you out with the implementation of the .Net wrapper.
--
Cezary Nolewajka
mailto:c.****** *************** @no-sp-am-eh-mail.com
remove all "no-sp-am-eh"s to reply
"Krzysztof Paz" <kp**@samorzad. pw.edu.pl> wrote in message news:OU******** ******@TK2MSFTN GP12.phx.gbl... Hi, There is a Java (SUN 1.4) server which using Object Input/Output Streams at SSL/Socket to communicate with Java clients. Now there is a request for making C# Client for this server also. SSL layer could be done with Org.Mentalis.Se curity.dll from seclib-1.0 Mentalis package - its fine... But, threre is a problem: How to properly communicate from C# language to Java.ObjectInpu tStream - cause I've tried many times, and always get the Java exception about wrong stream header. I've tought about using such code: ... Connection = new SecureSocket(Ad dressFamily.Int erNetwork, SocketType.Stre am, ProtocolType.Tc p, options); Connection.Conn ect(new IPEndPoint(Dns. Resolve(server) .AddressList[0], int.Parse(port) )); Send("GET_SERVE R_VERSION.CSHAR P.SSL.MENTALIS\ r\n", "UNKNOWN HEADER"); ... protected void Send(string data, Header header) { System.IO.Memor yStream memOut = new System.IO.Memor yStream(); System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er formatter = new System.Runtime. Serialization.F ormatters.Binar y.BinaryFormatt er(); formatter.Seria lize(memOut, data, header); byte[] toSend = memOut.ToArray( ); int sent = Connection.Send (toSend); while(sent != toSend.Length) { sent += Connection.Send (toSend, sent, toSend.Length - sent, SocketFlags.Non e); } } ... - but I've no idea how to make proper header value - that would work... So, the question is: How to make proper conversation with Java Object Streams from C# language... ...receiving objects is also needed... My data objects from/to java server usually are strings, int, longs, bytes, dates, arrays and multidimensiona l arrays of its... Do you have any ideas or advices for me ? Regards, Chris
Krzysztof Paz wrote: Hi, There is a Java (SUN 1.4) server which using Object Input/Output Streams at SSL/Socket to communicate with Java clients. Now there is a request for making C# Client for this server also. SSL layer could be done with Org.Mentalis.Se curity.dll from seclib-1.0 Mentalis package - its fine...
But, threre is a problem: How to properly communicate from C# language to Java.ObjectInpu tStream - cause I've tried many times, and always get the Java exception about wrong stream header.
[...] So, the question is: How to make proper conversation with Java Object Streams from C# language... ...receiving objects is also needed...
My data objects from/to java server usually are strings, int, longs, bytes, dates, arrays and multidimensiona l arrays of its...
I wouldn't say it's impossible, but that requires a conversion of .NET's
class representation to the JRE's format. I wouldn't want to integrate two
applications at such a low level of abstraction.
I would implement a Java based facade that translates SOAP calls from your
..NET client to Java object I/O to the application server.
Cheers,
--
Joerg Jooss jo*********@gmx .net
- Try wether using J# you can send objects to the Java server or if that
produces .NET serialized This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Offer |
last post by:
Hi, I create a TCP connection between client & server and I need to
send vectors via ObjectInputStreams back and forth (the client
initiates the protocol).
The connection is established successfully, the client sends its first
request and the server responds accordingly, the client receives the
response and tries to send another request (the request Vector is
created successfully) but something is wrong...
The following line (located in a...
|
by: Abhijit Gadekar |
last post by:
Hello,
I am getting a problem with objectinputstream and fileinputstream.
Whenever I try to close a ObjectInputStream object it gives an
Exception. And if I try to delete the associated file on disk, the
file doesnt get deleted.
The code I have used is of following manner.
File tempfile=new File("somefile");
FileInputStream fis=new FileInputstream(tempfile);
|
by: Krzysztof Pa¼ |
last post by:
Hi,
I want to make simple client in phyton, which would be able to communicate
with Java server using SSL sockets.
There is the Java clients, which is doing this - so I'm pretty sure, that
Java server works OK.
I've heard, that P2.3 has SSL support included in himself and also, I was
trying P2.2 with pyOpenSSL wrappers and extensions, but unsuccesfuly...
So, could you give me a few lines of python code which makes such things:
|
by: Dan |
last post by:
Hello.
I have recently tried upgrading the MySql connector for my servlet
from 2.0.4 to 3.0.9. I have found a minor limitation in 2.0.4 and was
hoping that 3.0.9 would fix it. However, now I am having a serious
problem with the latest connector. During login, it seems to me that
when validating the password, which is stored as a byte array in the
database, the MySql connector is passing back the password info as a
Byte. The...
|
by: rajbala |
last post by:
Hi all,
I am a newbie to JSP. I had a program in client and server by using java.
But i want the same program in JSP. Please help me.
server:
// TCP server which waits for messages from a client - non threaded
import java.io.*;
| |
by: blackraven1425 |
last post by:
The ObjectInputStream in this code is giving a EOFException. Do I need to do anything special to get this to work withou the EOF exception? It gives the exception at the line of the first instance of ObjectInputStream.
public static ArrayListSerial getList() {
try {
try{
try {
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream("J:\\collectibles.dat")));
Object inObject;...
|
by: bballpitcher65 |
last post by:
ok...i have a very large program, but i keep getting this error.Exception in thread "main" java.lang.NullPointerException
at flightlog.Totals.importFiles(Totals.java:29)
at flightlog.Totals.totalling(Totals.java:47)
at flightlog.AppStart.thirdResponse(AppStart.java:63)
at flightlog.AppStart.AppStart(AppStart.java:28)
at flightlog.Main.main(Main.java:26)
|
by: Humakt |
last post by:
I'm trying to figure a good way to handle saving game state to file (common save/load game function in games). ObjectOutput/InputStream seems most promising so far.
However,the object I'm saving contains lots of other objects which in turn contain other objects. All objects implement Serializable (I've given them all serialVersionUID = 1, not sure whether it matters).
It seems to write the object properly but loading it is a bit of a...
|
by: yeshello54 |
last post by:
so here is my problem...in a contact manager i am trying to complete i have ran into an error..we have lots of code because we have some from class which we can use...anyways i keep getting an error when i do the following. if you add a contact with up to 13 fields it will be stored in a data structure. i have a tabbed pane that will show six of the 13 fields for that contact. when you double click the contact i want it to pop up and show all 13...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |