Re: C# client to Java ObjectInputStream - howto ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Cezary Nolewajka (c.nolewajka-no-sp-am-eh_at_no-sp-am-eh-mail.com)
Date: 02/15/04


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
> 
> 


Relevant Pages

  • C# client to Java ObjectInputStream - howto ?
    ... There is a Java server which using Object Input/Output Streams at ... SSL/Socket to communicate with Java clients. ... protected void Send(string data, Header header) { ... How to make proper conversation with Java Object Streams from C# language... ...
    (microsoft.public.dotnet.languages.csharp)
  • Most users cant connect to our SSL-- help!
    ... I've included all relevant SSL settings from our ... Subject: Large percentage of customers cannot connect to https: ... server, which then grinds indefinitely. ... "2) Your secure order form is not working. ...
    (comp.security.misc)
  • Most users cant connect to our SSL-- help!
    ... I've included all relevant SSL settings from our ... Subject: Large percentage of customers cannot connect to https: ... server, which then grinds indefinitely. ... "2) Your secure order form is not working. ...
    (comp.security.ssh)
  • Most users cant connect to our SSL-- help!
    ... I've included all relevant SSL settings from our ... Subject: Large percentage of customers cannot connect to https: ... server, which then grinds indefinitely. ... "2) Your secure order form is not working. ...
    (comp.security.unix)
  • Re: Antw: Re: LDAP Authentication Problem
    ... TLSv1 und wird auf einen SSL Client Hello Request mit TLSv1 nicht ... antworten anstatt ein SSLv3 Server Hello. ... the LDAP PAM module and the shadow package. ...
    (de.comp.sys.novell)