Re: C# client to Java ObjectInputStream - howto ?
From: Cezary Nolewajka (c.nolewajka-no-sp-am-eh_at_no-sp-am-eh-mail.com)
Date: 02/15/04
- Next message: Cezary Nolewajka: "Re: Open existing MSMQ"
- Previous message: Cezary Nolewajka: "Re: C# equiv to VB IsNumeric ?"
- In reply to: Krzysztof Paz: "C# client to Java ObjectInputStream - howto ?"
- Next in thread: Joerg Jooss: "Re: C# client to Java ObjectInputStream - howto ?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 15 Feb 2004 12:41:15 +0100
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.nolewajka-no-sp-am-eh@no-sp-am-eh-mail.com
remove all "no-sp-am-eh"s to reply
"Krzysztof Paz" <kpaz@samorzad.pw.edu.pl> wrote in message news:OU7IXB48DHA.1804@TK2MSFTNGP12.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.Security.dll from seclib-1.0
> Mentalis package - its fine...
>
> But, threre is a problem:
> How to properly communicate from C# language to Java.ObjectInputStream -
> 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(AddressFamily.InterNetwork,
> SocketType.Stream, ProtocolType.Tcp, options);
> Connection.Connect(new IPEndPoint(Dns.Resolve(server).AddressList[0],
> int.Parse(port)));
> Send("GET_SERVER_VERSION.CSHARP.SSL.MENTALIS\r\n", "UNKNOWN HEADER");
> ...
> protected void Send(string data, Header header) {
> System.IO.MemoryStream memOut = new System.IO.MemoryStream();
> System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter =
> new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
> formatter.Serialize(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.None);
> }
> }
> ...
> - 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 multidimensional arrays of its...
>
> Do you have any ideas or advices for me ?
>
> Regards,
> Chris
>
>
- Next message: Cezary Nolewajka: "Re: Open existing MSMQ"
- Previous message: Cezary Nolewajka: "Re: C# equiv to VB IsNumeric ?"
- In reply to: Krzysztof Paz: "C# client to Java ObjectInputStream - howto ?"
- Next in thread: Joerg Jooss: "Re: C# client to Java ObjectInputStream - howto ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|