Link to home
Start Free TrialLog in
Avatar of alexgaga
alexgaga

asked on

Use ASN.1 description to send an integer with socket

Hello,
this is my ASN.1 description

Demo-module DEFINITIONS ::=       -- Module-name DEFINITIONS ::= BEGIN

BEGIN
 
ClientFirstRequest ::= SEQUENCE {                  

   clientInt     INTEGER

   }        

ServerFirstResponse ::= SEQUENCE {                

   serverInt    INTEGER ,        

   serverString     IA5String  
 
 }  

ClientSecondRequest ::= SEQUENCE {                  

   clientString     IA5String

   }    

ServerSecondResponse ::= SEQUENCE {                

   serverResponse     IA5String
 }  

 

END                                      -- end of module, END required

I have a code who send an integer to a server , it work perfectly

DataOutputStream dos = new DataOutputStream(_socket.getOutputStream());
 dos.writeInt(4);

Open in new window


But I  tried to use the ASN.1 classes and i have a problem, I tried the following code, but I have an error in the setValue method

     
  ClientFirstRequest h = new ClientFirstRequest();
        h.setValue(4);
        BerOutputStream bos = new BerOutputStream(_socket.getOutputStream());
         h.encode(bos);

Open in new window

User generated image
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial