Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Client FB - C# Server communication
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Anro le Roux  
View profile  
 More options Oct 11 2011, 12:34 am
From: Anro le Roux <alerou...@gmail.com>
Date: Mon, 10 Oct 2011 21:34:13 -0700 (PDT)
Local: Tues, Oct 11 2011 12:34 am
Subject: Client FB - C# Server communication
Hi all,

I want to have the standard Client FB communicate with a C# server
program by means of socket programing.

I saw that the format that the Client FB sends to the server is:

U \0 \5 \0 h \0 a \0 l \0 l \0 o \0

where \0 is a character with value 0 and \5 is a character with value
5 showing 5 characters where send with the message "hallo". I decoded
the string in C# and assumed that the Client FB wil recieve the same
format. But if I send the same string back, the Client FB outputs the
correct "hallo" string but the FB STATUS change to "INVALID OBJECT".

Is there a quick way to fix this? I looked at the ASN.1 encoding but
Im having a hard time to figure it out.

As a mechanical engineer, this is unknown ground, so sorry if it is a
silly question. :)

Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Christensen  
View profile  
 More options Oct 11 2011, 10:07 am
From: James Christensen <james.h.christen...@gmail.com>
Date: Tue, 11 Oct 2011 10:07:58 -0400
Local: Tues, Oct 11 2011 10:07 am
Subject: Re: [FBDK] Client FB - C# Server communication
ASN.1 is a Tag/Length/Value notation. Your example is missing the Tag
and half of the Length for the STRING data type.
The correct contents of the message in hexadecimal notation would be
50 00 05 68 61 6C 6C 6F
Here the Tag is 50, Length is 0005 and Value is as indicated.

For some data types the Length value is implicit in the Tag type; for
others (such as STRING) it is often encoded more simply than the more
complex rules given for ASN.1.

You can learn the formatting of messages by using the CODEC_TEST
configuration in the src/ita folder. Instructions for using this
configuration are at http://www.holobloc.com/doc/ita/panels/index.htm
.
--
Best regards,
Jim Christensen

On Tue, Oct 11, 2011 at 12:34 AM, Anro le Roux <alerou...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anro le Roux  
View profile   Translate to Translated (View Original)
 More options Oct 11 2011, 4:25 pm
From: Anro le Roux <alerou...@gmail.com>
Date: Tue, 11 Oct 2011 13:25:44 -0700 (PDT)
Local: Tues, Oct 11 2011 4:25 pm
Subject: Re: Client FB - C# Server communication
Thank you Mr Christensen,

I finally got it working, here is my c server code:

     buffer[0] = (char) 0x55;
     buffer[1] = (char) 0x00;
     buffer[2] = (char) 0x05;
     buffer[3] = (char) 0x00;
     buffer[4] = (char) 0x68;
     buffer[5] = (char) 0x00;
     buffer[6] = (char) 0x61;
     buffer[7] = (char) 0x00;
     buffer[8] = (char) 0x6C;
     buffer[9] = (char) 0x00;
     buffer[10] = (char) 0x6C;
     buffer[11] = (char) 0x00;
     buffer[12] = (char) 0x6F;

     //assumed the same    ,          55 00 05 00 68 00 61 00 6C 00 6C
00 6F, and buffer length 13, gives "hallo" and "OK"
     //from the CODEC_TEST , 50 00 00 55 00 05 00 68 00 61 00 6C 00 6C
00 6F, and buffer length 16, gives "桡汬漀  o" and "INVALID_OBJECT"
     //suggested           ,          55 00 05 68 61 6C 6C
6F               , and buffer length 8 , gives "" and "OK"

     n = write(newsockfd,buffer,13);

as you can see I tried everything (spend much time) and finally got it
working with the way I used all along. Embarrassed... the trick was to
set the numbers of bytes sent, in the write command, correctly ...
oops.

Your time and assistance are much appreciated, I would have given up
if it wasn't for your help.

Regards
Anro

On Oct 11, 4:07 pm, James Christensen <james.h.christen...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Christensen  
View profile  
 More options Oct 11 2011, 4:47 pm
From: James Christensen <james.h.christen...@gmail.com>
Date: Tue, 11 Oct 2011 16:47:55 -0400
Local: Tues, Oct 11 2011 4:47 pm
Subject: Re: [FBDK] Re: Client FB - C# Server communication
Yes, for the basic Unicode character set you use the 55 (WSTRING) data
type with two bytes per character and a MSB of 00 for each character.

The tag is defined in Annex E.3.2 of IEC 61499-1 as [APPLICATION 21],
or in hex: 40 (APPLICATION) + 15 (21 decimal).

The specialized encoding for string types is given in the Compliance
Profile at http://www.holobloc.com/doc/ita/index.htm, in subclause
5.4.4.2 which you can access from the Table of Contents.

Hope this helps you navigate around the standard and Compliance
Profile if and when you need to encode other data types.
--
Best regards,
Jim Christensen

On Tue, Oct 11, 2011 at 4:25 PM, Anro le Roux <alerou...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Anro le Roux  
View profile  
 More options Oct 12 2011, 3:10 am
From: Anro le Roux <alerou...@gmail.com>
Date: Wed, 12 Oct 2011 00:10:32 -0700 (PDT)
Local: Wed, Oct 12 2011 3:10 am
Subject: Re: Client FB - C# Server communication
Great, Thank you Mr. Christensen,

Thank you for explaining what I am actually doing and where I can find
the help. Al this reverse engineering is totality against my
personality.

Relieved... your information is of much value to me.

Regards
Anro

On Oct 11, 10:47 pm, James Christensen <james.h.christen...@gmail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »