Sending bytes issue

Hi
I am implementing an echo server and a client to measure RTT and throughput of a TCP link. I have been provided with a detailed protocol the server and client must follow.
Here is the problem:
The server at a certain point will be waiting for the client to send data in the following format <'m'><space><sequence #><space><payload>. The payload will have to be either 1, 100, 200, 400, 800, and 1000 Bytes.
Since I've implemented the server and the client both to read and write strings/characters to each other, I dont know how to send and receive the payload part of the message with a desired size.
Any idea how I can send and parse a desired number of bytes in/from a message (a string message)??
Although I know that a character is encoded as 2 bytes, but what do I do about this 1 byte? would I need to recode my client and server to work with byte streams?
Thanks
Message was edited by:
eXKoR

Ok now I know how to send 1 byte but I still dont want to recode my server and client sending and parsing ALL messages as bytes.
How would I go about sending the first part of the message as characters and the payload as byte[] and being able to break this message into the correct pieces at the server end?
Thanks

Similar Messages

  • How to send byte array and String values to servlet from Swing application

    Hi all,
    I am new to swing, servlet, and socket connection.
    I have swing application to draw images and some input data. I dont know to send to server.
    byte[] buf = baos.toByteArray();
    URL servletURL = new URL("http://10.70.70.1:8080/servlet/SaveImage)
    URLConnection conn = servletURL.openConnection();
    conn.setDoOutput(true);
    BufferedWriter out = new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );
    out.write(buf&a=aaaa&b=bbbbb);
    out.flush();
    out.close();
    can I do like this. Strings are received in server side perfect. but i cant get byte array data. Please help me.
    Thanks in advance.

    <img src="myservlet">
    In your myservlet:
    response.setContentType("image/jpeg");
    then write your image date via ImageIO that uses response output stream.

  • Sending bytes to multiple recipients

    I send certains bytes to different computers from a server and would like to log the status if they have successfully reached their destination, in one record.
    My current process is:
    The server sends an object DELIVERY with bytes and a unique key in it to all recipients that need those bytes. The key is the same for all people who receive the bytes as well. I create an array of LOGS which stores the key and the number of receivers on the server side, such that when the receiver gets the bytes and send a message back to the server, we check the array of LOGS for the unique key and check if we are waiting for anymore users. Once our receiver count in the LOG file is 0, we log the status.
    Any better ways of doing such a task?
    Thanks

    Krytical wrote:
    Read the thread before posting. My code works but his suggestions allow my code to be less prone to errors.I did read the thread. How can you say your code "works" but then go on to say it is prone to errors? That isn't what I think of as "working".
    But in communications processes, there's often a trade-off. It would be even more efficient if you didn't bother to do any checking at all. That's why I was objecting to efficiency as a goal in that case.

  • Mail Sender adapter issue in PO7.4

    Hello Experts,
    We are migrating from PI7.0 to PO7.4, where in we are struck up with an issue of Mail Sender Interface.
    Here we have a scenario of Mail to Proxy where we are processing attachment(CSV file). But here when I we run the interface mail body is being processed not the attachment. Also could nt see the Payload as when I click on the Attachment payload a pop up is coming and closing automatically.
    Can someone please suggest where it went wrong as this is working in existing PI7.0 version.
    Thanks.
    VR

    Hi VR
    Have you tried swapping by Payload name?
    Please try it out with the following configuration, and remove any extra lines - there are duplicate key names and values in your configuration.
    You should be able to see the successfully swap by payload name in the audit log as shown below.
    Rgds
    Eng Swee

  • Sender AS2 Issue

    Hello,
    We are designing an EDI 820 interface from a third party to a file using AS2 inbound adapters with SSL. We have installed the certificates and they are showing status green in NWA. But the partner is getting a 403- Forbidden error.
    I have checked the URL sent to the partner is valid. It comes with a status 405.
    I have checked for multiple sender agreements but none although we have one for MDN with a diff receiver interface.
    I have checked the public key of the partner and the private keys of us are properly set in the sender agreement.
    I have checked the AS2 id used by the partner and us and they are set right in the party definition.
    What else could trigger a 403 issue?
    Teresa

    Hi,
    The firewall proxy looks good as the network team could see a packet come and hit PI but then it never showed up in any loggs at PI.
    Thanks Doss for the forum discussion link. It just made me think we have another sender agreement for our MDN with the same sender and receiver Party but with a different sender interface for the MDN. Could this be an issue as I dont see any problem with the SSL setup?
    Teresa

  • External send output issue

    Hi Friends,
    We have 3 output types ZNEU, ZCON & ZCMR for which we send email to vendor.  For three vendors, ZNEU external send is working fine (Medium 5) , where as for ZCON & ZCMR (medium 5) is giving error, it gives error as below "
    1. Please enter an address number
    2. Communication type  cannot be used
    Message no. SVN000
    Diagnosis
    Message type ZCON should be sent with communication type .
    System Response
    Communication type  is not supported by the conversion module.
    Procedure
    Use one of the supported communication types:
    Printer (LET)
    Fax (FAX)
    Telex (TLX)
    X.400 (X40)
    Mail via Internet (INT)
    Mail via SAPoffice (RML)
    This ZCON & ZCMR ouput type with external send is working fine for other vendor, can you please help me to understand what we are missing here , we have checked the condition records also , which is fine, any specifc condition record to be mainatained for this ?
    Please help , as this is a very critical issue for us.
    Thanks & Regards,
    Vikas

    Hi,
    Thanks for your reply.
    Email id is maintained for these vendors, as output type ZNEU is already getting sucessfully transited with external send process for these vendors. External send is failing for ZCON & ZCMR output only.
    Kindly advice.
    Regards,
    Vikas Mayekar

  • Sender JDBC Issue

    hi friends,
    In JDBC-ServerProxy-Clientproxy-file
    In this scenario i am triggering client proxy in the server proxy.. all are asyncronious connections..
    now the issue is JDBC adapter is triggering after the poll time evry time eventhoough it is updated in the table. i mean i am executing on base of flag and after that i am getting updating that flag.. after that when i monitor CC monitoring i can see the jdbc adapter is keep on triggering after 10 sec9poll intervel).. even though data is not there.. any suggestion how to stop that...what i need to check to solve this...
    Thanks & Regards
    Vijay

    This is a standard behaviour. JDBC and File adapter when used at sender side always keep on polling the sender system continuosly. This is the only way by which any update in database could be picked up by XI. Otherwise XI wont be able to understand the changes at sender side.
    If u want to change the behaviopurm then u may schedule ur communication channel if required.
    Regards,
    Prateek

  • JMS sender adapter issue for encrypted message

    Hello Folks,
    We have JMS to AS2 interface facing issues when JMS sender channel read the encrypted files placed in MQ queue, messages size is
    increasing to almost double when it reaches PI.
    When sending an encrypted message from MQ to AS2, message is showing in success flag but inbound file size is increasing almost double the size, when compared to message size placed in the MQ Queue. When partner is decrypting the message he is getting total garbage values. But it working fine for unencrypted messages,we are getting the same size as it is in MQ queue.
    Can you please trrough some light on the issue not getting excatly issue is in MQ or JMS sender adapter.
    Kind Regards
    Praveen Reddy

    Hi Praveen,
    the issue seems to be with your encryption/decryption mechanism rather then JMS adapter. if you have encrypted file in JMS queue then channel only pick the file and sent to target (i am assuming there is no tranformation). So it will not alter the file size.
    Please check how the file is encrypted before it places in JMS queue.
    regards,
    Harish

  • MDM Sender Adapter issue in SAP PI7.1

    Hi All,
    How to schedule(there is no poll interval in Sender communication channel) MDM PI sender Adapter.
    Everytime we need to start and stop the channel then only file is being picked up.
    I checked port details, file is not picking up automatically
    Please suggest me.
    Reagrds,
    Hemanth

    Hi Hemanth,
    There are different versions of the MDM PI Adapter which correspond to the relevant PI version: one for PI 7.0 and the other for PI 7.1; the two are not interchangeable. Ensure that you have downloaded the correct version for your landscape i.e. PI 7.1
    Setting Up Outbound Messaging from MDM:
    Make sure that the MDM Java API (Connector) deployed on the J2EE engine matches the version of the MDM server on which the repository is mounted.
    Also, Check that there is no more than one MDM sender configured per MDM outbound port in your system landscape
    For more details, refer this below link
    http://help.sap.com/saphelp_nwmdm71/helpdata/en/48/9854c94d3217cee10000000a421937/content.htm
    Also, refer SAP Note 1337471 - Help for analysis of MDM PI Adapter messaging issues
    https://websmp130.sap-ag.de/sap/support/notes/1337471
    Thanks and Regards,
    Mandeep Saini

  • SOAP sender adapter issue

    Hi,
    We are facing a peculiar issue when using SOAP sender adapter.It is a SOAP-XI-ECC scenario.
    We have created WSDL using propose URL. Edited the address location in WSDL and included QoS=ExactlyOnce.
    When we are testing from SOAPUI, it is making a asynchronous call, which is the requirement. But when the actual sender is sending the data using the same WSDL, it is making synchronous call. Any idea if Synchronous/Asyncronous decision/setiing is made at XI end or the portal end? And what is the solution?
    Thanks,
    Vishal

    Hi Shabarish,
    As mentioned in my query I have already tested it from SOAPUI and it is making asynchronous call.
    URL is:
    [http://server/sap/xi/engine?type=entry&version=3.0&Sender.Service=BusinessService&Interface=http://namespace^MI_product_oa&QualityOfService=ExactlyOnce]
    Regards,
    Vishal

  • How to send byte array of image with 300dpi.

    Hello fiends
                       i am making an application in which i have to send the byte array of an image with 300dpi.
    so i am using image snapshot class for that and use that code.
                        var snapshot:ImageSnapshot = ImageSnapshot.captureImage(cnvParent,300);
                        var bdata:String = ImageSnapshot.encodeImageAsBase64(snapshot);
    but when i send that bdata to php end using httpService.The size at other end of image increases surprisingly.i means it will increase its actual height and actual width.so is there any way to overcome this increase in size when i bitmapped image at 300 dpi?
    if there any way then please tell me.waiting for your reply.
    Thanks and Regards
        Vineet Osho

    Thanks david for such a quick reply.the link is really helpful.So we have to calculate the screendpi thruogh our code and then set the height and width of image.is there any simple way to sort out my problem.i just want to print my image at 300dpi but i am using image snapshot class so its taking the snap of my container(image) and save the image at 96 dpi which is dpi of my screen(monitor).so is there any way or any class in flex through which i got the image at its original dpi.i am not stick on 300 dpi but i m getting image from backend through xml at 300dpi.thats why i want the byte array i am sending should be at 300dpi.i am totally confused now.so please help me.
    Thanks and regards
      Vineet osho

  • Outlook 2010 Send/Receive Issue

    I have Windows. Office 2010. Norton Internet Security.
    Microsoft Windows 8 x64 Business Edition (Build 9200)
    Dell Inc. Inspiron 7720
    iTunes 11.0.4.4
    QuickTime 7.7.4
    FairPlay 2.4.14
    Apple Application Support 2.3.4
    Using Outlook 2010, pop email addresses, if I edit a email in the outbox, it will get stuck there and not send. No errors. However, when i disable the iTunes outlook com add-in, it works as it should.
    There is a bug in iTunes & Outlook 2010.

    Hi,
    The user can’t send/receive any emails, not just can’t forward emails to his phone, right? If I’ve misunderstood something, please feel free to let me know.
    Did he forward emails to his phone with Outlook rules?
    Did he get any error message or the outgoing emails just stuck in Outbox?
    Can he send/receive emails from web access? If not, please contact the user’s ISP to help resolve the problem.
    If web mail works fine, we can follow the steps below to troubleshoot the issue on Outlook side:
    1. Please check if Outlook shows Disconnect on the bottom of the Window. Hold Ctrl key and right click on the Outlook icon on the tray, click Connection Status to check if your email account is disconnected.
    2. If the user installed any security programs, please temporarily turn off them to check the result.
    3. Try to reset Send/Receive settings to check the result. To do this, go to
    C:\Users\%username%\AppData\Roaming\Microsoft\Outlook\
    Locate the <profilename>.srs file and rename it to
    <profilename>.old and restart Outlook to check the result.
    4. If above not working, please try to create a new mail profile and setup the email account in the new profile to check the result.
    http://support.microsoft.com/kb/829918
    Hope this helps.
    Regards,
    Steve Fan
    TechNet Community Support

  • Fixing the Sender SMTP issue

    Hello,
    I'm dealing with a security issue in BO XI 3.0 (I think it's the same with previous version) .When you send a document via email and if you uncheck the default settings, you can enter any email address into the "From" Field. Even your CEO's address. The only condition is that this address exists in the SMTP directory.
    After looking on the forum, it's seems that it can't be fixed with any CMC settings. So I'm trying to secure it via the SDK. Does anyone has already done this before?
    I have 2 ideas, could you tell me which one seems the better for you ?
    When the "send email" form is populated, the idea is to retrieve the email of the connected user and fill the "From" field with it.
    During the form validation, there is a javascript function called checkSMTP ( ). This function checks that the "from" field is filled. Maybe could I check that the email address filled in the field is the same than the email address of the user connected?
    What do you think of those solution? Feasibility? Risk ? Security?
    Any help will be nice.
    Pierre

    I would suggest, if you have support, to open a SAP Incident and get clarification on why the behavior is inconsistent.
    One of the dangers in modifying InfoView is that it's just not designed to be modified, and modifications will likely break with a new service pack (i.e., not something you'd want to move forward with).
    Sincerely,
    Ted Ueda

  • RFC Sender Channel Issue : STFC_CONNECTION

    Hi All,
    There has been an issue with the RFC sender channels. When SAP triggers the data, we see an error in the RFC sender channel as below
    Error in processing caused by: com.sap.aii.af.rfc.afcommunication.RfcAFWException: senderAgreement not found: lookup of binding via CPA-cache failed for AdapterType RFC, AdapterNS http://sap.com/xi/XI/System, direction INBOUND, fromParty '', fromService '<ServiceName>', toParty '', toService '', interface 'STFC_CONNECTION', NS 'urn:sap-com:document:sap:rfc:functions' for channel '<ChannelName>' (channelId 7f84f67e7efe39949dc12a2f569236fb)
    But the data gets processed at the very next moment.
    Program ID used in the channel is same as the ID registered in SAP. Is there some configuration missing either at SAP PI or SAP R/3 system?
    Regards,
    Prajeet

    Hi Prajeet,
    please refer this wiki [link  |https://wiki.sdn.sap.com/wiki/display/XI/RFC+Faqs?showChildren=false]Q19,hope this helps.
    Check if you are using the same program ID in multiple scenarios. May be  if  you keep different the program ID names in different RFC adapters, it should resolve the error.
    also check here :/people/danny.deroovere/blog/2008/02/26/change-client-in-scenarios-with-sap-business-system
    Regards,
    Srinivas

  • 10.1 Update Did Not Fix Sending Email Issue!

    after waiting for like forever for AT&T to release 10.1.0.2019, i heard rumors that it would fix the issue i was having with emails not sending while connected to WIFI but will send when not on WIFI.  well i am still having the same problem with 10.1 and have to disconnect from WIFI in order to send emails (not fun).
    in addition, i have already checked and my POP and SMTP ports [are not] blocked when connected to WIFI.  so what the heck is going on here?!  argh.
    Solved!
    Go to Solution.

    RobGambino wrote:
    Are you able to do anything else while your WIFI examples are like surfing the net facebook twitter etc ?
    yes i can do everything else just fine on WIFI.
    i am not using my home ISP, but i will try that when i get home. 
    i have already been down this road with BB Support asking me to connect at a coffee shop, restaurant, etc, etc.  they all exhibited the exact same resultant.  cannot send email but will send that waiting email once i switch off of WIFI.
    i forget to add that receiving email is unaffected. 
    port 25 is the smtp (outgoing) port, and port 110 is the pop3 (incoming) port.

Maybe you are looking for