TCP Programming / Why do not need to worry about Big and little Endian?

Please help, I do not understand this concept please explain.
The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
Why does the JAVA TCP software does not need to perform the reversal?
Thanks,
Alex

But why would I need to use the DataOutputStream,You don't have to.
But that's what the Java API provides for sending java primitives over a stream. You wouldn't have to use that. You could chop the int into bytes yourself, and send the bytes, and your Java code still wouldn't have to worry about the endiannes of it, because the VMs handle that.
DataOutputStream just does the chopping and reassembling for you, so it's easier than doing it yoursefl.

Similar Messages

  • Why do not need to worry about Big and little Endian in Java

    Please help, I do not understand this concept please explain.
    The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
    The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
    This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
    Why does the JAVA TCP software does not need to perform the reversal?
    Thanks,
    Alex

    Java doesn't give you direct access to the individual bytes of a larger data item such as an integer. For this reason you don't have the usual endian problems that occur in C. The actual handling of this is in the DataOutputStream and DataInputStream where the integer is coverted to and from bytes using arithmetic, not by fiddling with the internal structure.
    Note that regardless of the machine architecture the operation value%256 will return the low order 8 bits. It's less efficient than assigning an int* to a char*, but it's not fraught with the endian problems or any of the other hardware baggage.

  • I have upgraded my MacBook Pro 15 late 2011 to 8Gb RAM, now when I go to about this mac in it more info it doesn't show AMD graphics card as it used to before, it just show  Intel HD Graphics 3000 512 MB is that a problem that I need to worry about?

    I have upgraded my MacBook Pro 15 late 2011 to 8Gb RAM, now when I go to about this mac in it more info it doesn't show AMD graphics card as it used to before, it just show  Intel HD Graphics 3000 512 MB is that a problem that I need to worry about?
    and in system report >> hardware >> Graphics/Display >> it shows both grafics card listed.

    Some Mac's when the RAM is increased the Intel HD 3000 integrated graphics will bump itself up to the higher video RAM it takes, this seems to be what occured.
    It also means the dedicated graphics card will be used less, but only so slightly less.
    You obviously still should have both, you can test this by turning off Graphics Switching in Energy Saver, that will use the decicated AMD card all the time.
    You can also run Cinebench and compare the scores here
    Mac video card performance

  • Do I need to worry about this?

    It has been an interesting few months with my one year old 13" MBP. Lots of spinning beach balls followed by a hard drive crash. Apple was quick to replace the hard drive. And as I had everything backed up on Time Machine I was able to quickly restore everything.
    All was good for a few months until the beachballs, freezes, and finder crahes began again. Made another trip to the Genius bar where they thought I might have re-downloaded a corrupt file from Time Machine. They cleaned my temp files and caches and things seemed to work well in the store.
    When I returned home I had the same issues. They had prepared me for this. So a system restore, a re mount and re start of time capsule and everything seems to be working well. Speedy, no crashes, no freezes.
    The issue is that I wanted to double check so I ran disk verify and permission verify on the disk utility. To my surprise it came back with a LONG error log as below. So long, I could not get it all into this post. But it seems like a recurrent message. Do I need to worry about any of this? What should I do next, if anything? Thanks in advance for your response.
    Verifying volume “Macintosh HD”
    Performing live verification.
    Checking Journaled HFS Plus volume.
    Checking extents overflow file.
    Checking catalog file.
    Checking multi-linked files.
    Checking catalog hierarchy.
    Checking extended attributes file.
    Checking volume bitmap.
    Checking volume information.
    Invalid volume file count
    (It should be 624512 instead of 624514)
    Invalid volume directory count
    (It should be 172781 instead of 172779)
    The volume Macintosh HD was found corrupt and needs to be repaired.
    Error: This disk needs to be repaired. Start up your computer with another disk (such as your Mac OS X installation disc), and then use Disk Utility to repair this disk.
    Verify permissions for “Macintosh HD”
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAssistant.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAssistant.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDocument.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDocument.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDrives.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUDrives.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUStatisticsPanel.nib/keyedobjects.nib ", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUStatisticsPanel.nib/keyedobjects.nib ", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTaskSheet.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTaskSheet.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTasks.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUTasks.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUWirelessPanel.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUWirelessPanel.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/APPanels.nib/keyedobjects.nib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/APPanels.nib/keyedobjects.nib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AUFirmwareDownloader.nib/keyedobjects.n ib", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AUFirmwareDownloader.nib/keyedobjects.n ib", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortAssistant.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortAssistant.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortErrors.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortErrors.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortSettings.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortSettings.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortTimeZones.strings", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortTimeZones.strings", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h elpindex", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h elpindex", should be -rw-r--r-- , they are -rw-rw-r-- .
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h tml", should be 0, group is 80.
    Permissions differ on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AirPortUtilityHelp/AirPortUtilityHelp.h tml", should be -rw-r--r-- , they are -rw-rw-r-- .

    Scott Adelman wrote:
    The issue is that I wanted to double check so I ran disk verify and permission verify on the disk utility. To my surprise it came back with a LONG error log as below. So long, I could not get it all into this post. But it seems like a recurrent message. Do I need to worry about any of this? What should I do next, if anything?
    Verifying volume “Macintosh HD”
    Invalid volume file count
    (It should be 624512 instead of 624514)
    Invalid volume directory count
    (It should be 172781 instead of 172779)
    The volume Macintosh HD was found corrupt and needs to be repaired.
    Error: This disk needs to be repaired. Start up your computer with another disk (such as your Mac OS X installation disc), and then use Disk Utility to repair this disk.
    You definitely need to repair your disk. If you can, boot from something else, such an external disk or the system discs that came with your Mac. You can also cause the disk to be repaired by booting into "Safe Mode": http://support.apple.com/kb/ht1564 . If that process can't repair your disk, you may need one of the more-powerful disk utilities such as Disk Warrior.
    Verify permissions for “Macintosh HD”
    Group differs on "Applications/Utilities/AirPort Utility.app/Contents/Resources/pl.lproj/AAUAdvanced.nib/keyedobjects.nib", should be 0, group is 80.
    You can ignore most permissions repair messages:
    http://support.apple.com/kb/TS1448

  • Do I need to worry about these event handlers in a grid from a memory leak perspective?

    I'm pretty new to Flex and coudn't figure out how to add event handlers to inline item renderer components from the containing file script so I attached the listnerers simply as part of the components themselves (eg <mx:Checkbox ... chnage="outerDocument.doSomething(event)"../>):
    <mx:DataGrid id="targetsGrid" width="100%" height="100%" doubleClickEnabled="true" styleName="itemCell"
          headerStyleName="headerRow" dataProvider="{targets}"
          rowHeight="19" fontSize="11" paddingBottom="0" paddingTop="1">
         <mx:columns>
         <mx:DataGridColumn width="78" dataField="@isSelected" headerText="">
         <mx:itemRenderer>
              <mx:Component>
                   <mx:HBox width="100%" height="100%" horizontalAlign="center">
                        <mx:CheckBox id="targetCheckBox" selected="{data.@isSelected == 'true'}"
                             change="outerDocument.checkChangeHandler(event);"/>
                        <mx:Image horizontalAlign="center" toolTip="Delete" source="@Embed('/assets/icons/delete.png')" useHandCursor="true" buttonMode="true"
                             click="outerDocument.deleteHandler(event);"/>
                        <mx:Image id="editButton" horizontalAlign="center" toolTip="Edit" source="@Embed('/assets/icons/edit-icon.png')" useHandCursor="true" buttonMode="true"
                             click="outerDocument.editHandler(event);"/>
                   </mx:HBox>
              </mx:Component>
         </mx:itemRenderer>
         </mx:DataGridColumn>
              <mx:DataGridColumn id="Name" dataField="@collectionDesc" headerText="Name" itemRenderer="com.foobar.integrated.media.ui.component.CellStyleForTargetName"/>
              <mx:DataGridColumn id="Created" width="140" dataField="@createDateTime" headerText="Created"  labelFunction="UiHelper.gridDateFormat" />
         </mx:columns>
    </mx:DataGrid>
    This grid is part of a view that will get destroyed and recreated potentially many times during a user's session within the application (there's a large dynamic nature to the app and views are created at run-time.) By destroyed I mean that the view that holds the above datagrid will no longer be referenced under certain circumstances and an entire new view object is created (meaning the old datagrid is no longer refernced and a new one is created.)
    I heard you should clean up event handlers when they are no longer used, and I know at what point the view is destroyed, but I don't know how to clean up the event handlers added to the item renderer components? Is it something that the Flex garbage collector will handle efficiently?
    Also, on a somewhat related note, how could I push the item renderer to an external component since in my event handlers for the item renderer buttons I need a reference to the datagrid.selectedIndex which, as an external item renderer I wouldn't have access to this containing grid?

    No. You don't need explicit cleanup in this case: if your outerDocument is going away, you have nothing to worry about. The event handler leak can happen in sort of the reverse situation: suppose you have a long-lived MyView that contains a custom DataGrid like the one below. Now suppose that MyView frequently destroys and re-creates the grid. And suppose that on its creationComplete event, the grid registers a listener for outerDocument's (MyView's) enterFrame Event. Unless you explicitly remove this listener, MyView will still have a reference to it even after the grid that registered the listener is destroyed (and garbage collected).
    This is a pretty contrived example, but it sort of illustrates the potential for leaks: a certain component is elligible for garbage collection, but some longer-lived component holds a reference to it (or part of it, such as a listener function). If the longer-lived component is elligible for GC as well, you don't really need to worry about proper cleanup. That's what you're paying the GC processor cycles for.

  • Why do we need to define RFC destination and user for material replication

    Dear Experts,
    why do we need to define RFC destination and user for material replication? Here we use crm middleware only for material replication. Could you please help me to understand it?
    regards,
    Ranjan

    Hello,
    As far as I know, you can use the same RFC destination already available in ECC to SRM to replicate materials.
    You can refer to note 720819.
    Regards,
    Ricardo

  • What is happening to 7.0.3? why do we need to connect to itunes and restore for 2 hours?

    what is happening to 7.0.3? why do we need to connect to itunes and restore for 2 hours? such a waste of time.

    No clue as you've provided not details.
    What exactly is the problem that was occuring that prompted you to restore via iTunes?

  • HT201250 If time machine backups hourly.  Why does it need to backup daily, weekly and monthly

    If time machine backups hourly.  Then why does it need to backup daily, seekly, and monthly?

    It doesn't.
    What it does is discard intermediate backups at the end of 24 hrs and keep just three spaced backups from the previous day.
    At the end of the next day, that day's will be reduced to 3, and the previous 3 trimmed to one; the last backup of that day.
    Daily backups are kept for a month, then trimmed to the last backup of the week.
    The weekly backups are kept until the disc runs out of space and TM starts deleting the oldest ones.

  • Why do we need separate t.codes KB11N and KB41N for reposting costs & rev?

    Hi,
    Why do we need separate t.codes KB11N and KB41N for reposting costs and revenues? I noticed that i can still use one t.code KB11N to post both costs and revenues, hence why do we need a separate t.code KB41N for revenues?

    Hi,
    The BAPI for costs allows more options than the one for revenues. For example, via BAPI_ACC_PRIMARY_COSTS_POST  you can select sender Network, what you cannot do via BAPI_ACC_REVENUES_POST. The same is for 'cost object' as a receiver; you can do it only via BAPI for costs. In other aspects, the BAPI for costs could be used to repost revenues as well.
    Regards,
    Eli

  • Why do you need to go about linking to services-config.xml in your flex compiler

    Why do you need to go about linking to services-config.xml in
    your flex compiler when you want to do remoting. It just seems like
    a complicated way to do things.

    Yeah I find this perplexing as well. I'm guessing it has something to do with Opalis origins perhaps.
    Would be good to understand why.

  • Why has not received the message about the change secret Questions?

    Why has not received the message about the change secret Questions on my email?

    Be patient. You don't get an immediately notification email. Record the Claim Number somewhere in case something goes wrong. It can take up to 72 hours. I got mine in about 54 hours.

  • Why we do not need sender agreement for Mail and SOAP adapter

    Hi SDN,
    I know, we do not need sender agreement for IDOC ,HTTP,XI adapters. As these three adapters will run in Integration engine of the abap stack.
    <b>In our scenario if sender is other than  IDOC or HTTP or XI .</b>
    By Refering Sivamni's blog.
    <b>/people/siva.maranani/blog/2005/05/25/understanding-message-flow-in-xi
    message will be pickedup by communication channel with the help of sender agreement and prepare XI message header by performing cpa cache lookup. then message will go to module processor etc.
    <b>In our scenario if sender is IDOC or HTTP or XI .</b>
    As these 3 adapters are run in Integration engine.
    Doubt 1:
    how the integration engine will create the xi message header like sender interface sender system name etc...
    Doubt 2:
    I believe SOAP and mail adapter will run in adapter engine.but i came to know that we do not need sender agreement and sender comm channel for these two adapters too...then how the XI message header will create...
    Please do correct me if i am wrong
    and throw some light on the same..
    Appreciate your help....
    Regards,
    Reehan.

    Reehan,
    Thanks for pointing me to that link. Guess I was wrong .,But,let me try to put to you why you need a sender agreement for a Sender SOAP Adapter,
    1. In the sender SOAP adapter , the Sender Interface and the Interface Namespace as provided in the fields Default Interface Name and InterfaceNamespace. The Name of the Sender Service is provided in the WSDL when you ceate the WSDL in the Integration Directory. So, as all details are available in either the Sender SOAP adapter or in the WSDL url you do not need a Sender Agreement. It is not obligatory but you can always create the Sender Agreement.
    2.  For the mail adapter , if you select the option XIPAYLOAD, you will have the option to mention the Interface Name and Interface Namespace under XI Parameters  and so in this case as once again the details provided in the sender agreement are available in the Sender Adapter itself the sender agreement is not needed for the mail adapter when you have select option XIPAYLOAD.
    If you have selected XIALL then you need a sender agreement.
    Regards
    Bhavesh

  • What do I need to worry about when running a VI for an extended amount of time?

    Hi, I'm fairly new to LabVIEW as a program, but not new to programming as a whole.
    I'm attempting to build a VI which will, hopefully, be run continuously and take data for weeks-months at a time.
    I've never built a VI, let alone a program, which will be run continuously for so long, and so I'm unsure as to what I should be concerned about. I'm looking right now at optimizing, as best I can, memory allocation, algorithms, etc. but I suppose my main question is: What should I really be worrying about when programming a VI which will be run continuously for an extended period of time?
    Solved!
    Go to Solution.

    In the structure of your VI's, be certain that you are not repetively creating things such as references to queues, or file references, or DAQ tasks, or anything without closing them.  I was working on one application where a DAQ task was getting created every loop iteration and not being closed.  It crashed the PC hard with a blue screen of death after about 20 minutes of operation, through debugging and before I found the cause, I saw I had about 80,000 to 100,000 iterations of a loop fairly consistently before the crash.
    If this loop had run at a slower rate, it might have taken days or weeks before the PC would have crashed.  It would have seemed infrequent and would have taken longer to debug because I would never have seent the pattern.  If it takes a few failures before you discover the problem, it is a lot quicker to find the explanation after a few failures at 20 minutes per failure as opposed to 20 days per failure.  The problem was eventually found in a subVI several layers down and fixed.
    So if you pay attention to these things early enough, then hopefully they won't pop up and bite you weeks or months into a critical run of the program.

  • Why do I need Library at root level AND a library in the admin user folder?

    I have three user accounts in my macbook, I share it with two brothers. I'm the "administrator". Under my user account there is a library folder, same as with the other two users. But I also have a library folder at the root level when I open the "Macintosh HD" icon on the desktop. I notice that both the library at my user folder and the one in the root folder have items that have been updated recently.
    While I noticed that the individual user libraries are "normal" in size, the one at the root level is 11 GB.
    Why do I need the library at the root level? Can I consolidate that with the Library in my user folder?
    Thanks!

    Why do I need the library at the root level?
    For items which apply to all user accounts.
    Can I consolidate that with the Library in my user folder?
    No.
    (57249)

  • Why do we need to specify Role baseprovider and membership provider in Central Admin and security config files?

    Hi,
    why do we need to specify role base provider and membership provider files in central admin and securiy config files.
    thanks,
    gaurav

    We use 3 settings in Forms based auth:
    1 Membership = This contains Users and groups information. (This table also has username and password)
    2 ConnectionString = Connetion details to connect to database is stored here(servername, databasename, username, password, port )
    3 Role = This table contains all the Roles (Admin, contibutor, etc of the data source)

Maybe you are looking for