Working set, virtual bytes and private bytes

Hello everyone,
I am using Windows Server 2003 Performance Counter tool to monitor the memory consumed by my process.
The interested terms are working set, virtual bytes and private bytes. My questions are,
1. If I want to watch the real physical memory consumed by current process, which one should I monitor?
2. If I want to watch the physical memory + swap file consumed by current process, which one should I monitor?
3. Any more clear description of what these terms mean? I read the help from Performance Counter tool, but still confused
which one(s) identifies the real used physical memory, and which one(s) identifies the real used physical memory + page swap file, and which one(s) identifies the required memory (may not be really allocated either in physical memory or in swap page file).
If there are any related learning resource about the concepts, it is appreciated if you could recommend some. :-)
thanks in advance,
George

And for further benefit:
"Virtual bytes" is the total size of the not-free virtual address space of the process. It includes private committed, mapped, physically mapped (AWE), and even reserved address spaces. 
"Private committed" is the portion of "virtual bytes" that is private to the process (as opposed to "mapped", which may be shared between processes; this is used by default for code). This normally includes program globals,
the stacks (hence locals), heaps, thread-local storage, etc. 
Each process's "private committed" memory is that process's contribution to the system-wide counter called "commit charge". There are also contributions to commit charge that aren't part of any one process, such as the paged pool. 
The backing store for "private committed" v.m. is the page file, if you have one; if you have (foolishly in my opinion) deleted your page file, then all private committed v.m., along with things like the paged pool that would normally be backed
by the page file, has to stay in RAM at all times... no matter how long ago it's been referenced (which is why I think running without a page file is foolish). 
The "commit limit" is the size of RAM that the OS can use (this will exclude RAM used for things like video buffers) plus the total of the current size(s) of your pagefile(s). Windows will not allow allocations of private committed address space
(e.g. VirtualAlloc calls with the COMMIT option) that would take the commit charge above the limit. If a program tries it, Windows will try to expand the page file (hence increasing the commit limit). If this doesn't succeed (maybe because page file expansion
is disabled, maybe because there's no free disk space to do it) then the attempt to allocate committed address space fails (e.g. the VirtualAlloc call returns with a NULL result, indicating no memory was allocated). 
The "Working set" is not quite "the subset of virtual pages that are resident in physical memory", unless by "resident" you mean "the valid bit is set in the page table entry", meaning that no page fault will occur
when they're referenced. But this ignores the pages on the modified and standby page lists. Pages lost from a working set go to one of these lists; if the modified list, they are written to the page file and then moved to the standby list. From there they
may be used for other things, such as to satisfy another process's  need for pages, or (in  Vista and later) for SuperFetch. But until that happens, they still contains the data from the process they came from and are still associated with that process
and with that processes' virtual pages. Referring to the virtual page for which the physical page is on the standby or modified list will result in a "soft" page fault that is resolved without disk I/O. Much slower than referring to a page that's
in the working set - but much faster than having to go to disk for it. 
So the most precise definition of "working set" is "the subset of virtual pages that can be referenced without incurring a page fault." 

Similar Messages

  • Set up Virtual IP and Private IP for each node in RAC installation

    I am new to Oracle 10G RAC installation, based on the documentation, I need to assign a public IP, Virtual IP, private IP for each node, I know how to assign public IP for each node, I can assign the IP from the router, but I don't know how to assign the Virtual IP and private IP, since the private network is only connected by a switch, the switch is not able to assign IP to server, should I just go to the host file
    %SystemRoot%\system32\drivers\etc\hosts
    of each node to put IP in the file? what else should I do? I already read through the document from Oracle "Oracle Real Application Clusters, Quick Installation Guide for Oracle Database Standard Edition 10g Release 1 for window".

    I am still keep thinking why each node need a virtual IP address? if each mode has a virtual IP, which IP address the client can be specified? I have multiple application servers work as clients.

  • High bytes and low bytes?

    What are high bytes and low bytes? Thanks for helping.

    This may not be enough information to answer your question. How and where are the terms High bytes and Low bytes used?
    Often, a data type is represented using multiple bytes. For example, short is 2 bytes. Sometimes the most significant byte is the high byte while the least significant byte is the low byte.

  • To find out whether a character is of Single byte or Double bytes

    hi,
    is there any built-in class to find whether a character is a single byte or double byte. is there any method to do so?? If possible can someone provide a sample code snippet to do a check for single byte and double byte characters.
    thanx in advance.....

    If you are asking what size the char primitive is, it's 16 bits.
    If you want to know the numerical value of a char, you can cast it to an int and compare it to 255 to see if it fits in 1 byte.

  • I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    I pull fiftyfour bytes of data from MicroProcessor's EEPROM using serial port. It works fine. I then send a request for 512 bytes and my "read" goes into loop condition, no bytes are delivered and system is lost

    Hello,
    You mention that you send a string to the microprocessor that tells it how many bytes to send. Instead of requesting 512 bytes, try reading 10 times and only requesting about 50 bytes at a time.
    If that doesn�t help, try directly communicating with your microprocessor through HyperTerminal. If you are not on a Windows system, please let me know. Also, if you are using an NI serial board instead of your computer�s serial port, let me know.
    In Windows XP, go to Start, Programs, Accessories, Communications, and select HyperTerminal.
    Enter a name for the connection and click OK.
    In the next pop-up dialog, choose the COM port you are using to communicate with your device and click OK.
    In the final pop
    -up dialog, set the communication settings for communicating with your device.
    Type the same commands you sent through LabVIEW and observe if you can receive the first 54 bytes you mention. Also observe if data is returned from your 512 byte request or if HyperTerminal just waits.
    If you do not receive the 512 byte request through HyperTerminal, your microprocessor is unable to communicate with your computer at a low level. LabVIEW uses the same Windows DLLs as HyperTerminal for serial communication. Double check the instrument user manual for any additional information that may be necessary to communicate.
    Please let me know the results from the above test in HyperTerminal. We can then proceed from there.
    Grant M.
    National Instruments

  • What is the best way to switch between two sets of bookmarks, say 'work' and 'private'?

    I want to use to sets of bookmarks, so that when I'm working, I'm not distracted by my non-work bookmarks and vice versa. For the last couple of months, I've been using two user accounts to achieve this, but it's a bit of a PITA. Links from other applications, like Thunderbird mail are opened in the default profile. This means when I'm not at work and I click a link in an email, a new window is opened with my Firefox work profile.
    All I need is a trick or an extension to quickly switch bookmark sets. Or a way to switch profiles without opening a new Firefox window. Any ideas?

    You can't get Firefox to work as you are explaining you want. The Default Profile can't be changed on-the-fly to the Profile you are currently using. That message "Firefox is already running ..." comes up due to you or "something" trying to open a 2nd (or subsequent) Profile, unless that '''-no-remote''' command was used to open the additional Profile. And '''-no-remote''' won't work to open the Default Profile without causing issues with how Windows works with "calling up" the Default Browser.
    In response to your last statement - '''''"To separate my work and private stuff I only need to change the contents of my bookmarks bar, so I hoped there was some trick to maintain to groups of bookmarks."'''''
    This extension will allow you to change the Bookmarks Toolbar folder while you are using Firefox.
    https://addons.mozilla.org/en-US/firefox/addon/set-as-bookmarks-toolbar-folde/
    I just installed that extension and verified that it still works in Firefox 35.
    There is a context menu item added for '''"Set as Bookmarks Toolbar Folder"'''' that appears when the Bookmarks Menu Bar drop-down menu is used (not in the Library window or the Bookmarks Sidebar). That menu item appears when you right-click a folder in the Bookmarks Menu folder. It doesn't appear with the "Bookmarks Toolbar" folder or the "Unsorted Bookmarks" folder - only a folder that is in the "Bookmarks Menu".
    That should "solve" wanting to have two different settings for the Bookmarks Toolbar, but the Default Profile "thing" is still an issue for what you are trying to accomplish. I don't "see a fix" for that - without resorting to a 2nd Window User Account which is what I thought you were referring to by "I've been using two user accounts to achieve this" in your initial posting.
    And since the Menu Bar is hidden by default these days, you can use '''Alt''' then '''B''' to open the Bookmarks drop-down from the "revealed" Menu Bar so you can access that '''"Set as Bookmarks Toolbar Folder"''' menu item - without having to show the Menu Bar all the time.
    ''BTW, using "accounts" in lieu of "Profiles" can be confusing when discussing Firefox Profiles.''

  • 1 click youtube downloader version 1.5 isn't working I click it and it just says complete-0 bytes . i have firefox 3.6.8 om imac osx 10.6.5 . HELP

    i am running firefox 3.6.9 and have been running 1 click youtube downloader version 1.5 for ages for kds songs as i have 3 autistic children . suddenly , overnight it is no longer working at all . the download box just flashes up and says 0 bytes and nothing has been downloaded ? i have installed nothing new and changed nothing . i am running osx 10.6.5 . this has happened overnight as it was working fine yesterday .

    I can not get it working either but found easy you tube video downloader plugin works great.

  • Frame bytes, virtual memory and you

    Hi,
    I made a screensaver for a client using Flash and FlashJester
    Creator Pro. They told me that on some of their older machines, it
    is running out of virtual memory and crashing the machines. So we
    started looking at eliminating sections of the screensaver.
    We ran the diagnostics on the original FLA, and this is what
    we get:
    1 5464 5464 Scene 1 (AS 2.0 Classes Export Frame)
    2 34 5498
    3 16447 21945
    4 2736 24681
    5 10555 35236
    6 7891 43127
    7 55472 98599
    8 7438 106037
    So frame 7 is the problem right? I delete that entirely, just
    for kicks.
    1 7866 7866 Scene 1 (AS 2.0 Classes Export Frame)
    2 55 7921
    3 22266 30187
    4 3698 33885
    5 15978 49863
    6 10593 60456
    7 7 60463
    8 10050 70513
    And as you can see, the other sections suddenly GREW in size.
    Can somebody explain this to me. Does anybody have any better ideas
    on how to solve the "running out of virtual memory" issue?

    When this happens FireFox has to be closed using TaskMan and NO crash report is generated by Firefox!
    This crash happens daily because I am using hibernation on a regular basis. But there has been no crash report in abort:crashes since September 2011!
    So I can only post the Windows eventlog entry:
    '''Entry 1:'''
    ''Fehlerbucket 2554508690, Typ 5
    Ereignisname: AppHangB1
    Antwort: Nicht verfügbar
    CAB-Datei-ID: 0
    Problemsignatur:
    P1: firefox.exe
    P2: 8.0.0.4325
    P3: 4eb4a985
    P4: f85d
    P5: 5
    P6:
    P7:
    P8:
    P9:
    P10:
    Angefügte Dateien:
    C:\Users\Standard\AppData\Local\Temp\WER5F34.tmp.appcompat.txt
    C:\Users\Standard\AppData\Local\Temp\WER605D.tmp.WERInternalMetadata.xml
    Diese Dateien befinden sich möglicherweise hier:
    C:\Users\Standard\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppHang_firefox.exe_ff754f3c26af1f5eee4f88694b2b4d228d91d4_10c36bf0
    Analysesymbol:
    Es wird erneut nach einer Lösung gesucht: 0
    Berichts-ID: 44ea48bf-172e-11e1-af76-001bfc4f0ee6''
    '''Entry 2:'''
    ''Programm firefox.exe, Version 8.0.0.4325 kann nicht mehr unter Windows ausgeführt werden und wurde beendet. Überprüfen Sie den Problemverlauf in der Wartungscenter-Systemsteuerung, um nach weiteren Informationen zum Problem zu suchen.
    Prozess-ID: 1a58
    Startzeit: 01cca9ea3b1ff2ea
    Endzeit: 10
    Anwendungspfad: C:\Program Files (x86)\Mozilla Firefox\firefox.exe
    Berichts-ID: 44ea48bf-172e-11e1-af76-001bfc4f0ee6''

  • External Table - possible bug related to record size and total bytes in fil

    I have an External Table defined with fixed record size, using Oracle 10.2.0.2.0 on HP/UX. At 279 byte records (1 or more fields, doesn't seem to matter), it can read almost 5M bytes in the file (17,421 records to be exact). At 280 byte records, it can not, but blows up with "partial record at end of file" - which is nonsense. It can read up to 3744 records, just below 1,048,320 bytes (1M bytes). 1 record over that, it blows up.
    Now, If I add READSIZE and set it to 1.5M, then it works. I found this extends further, for instance 280 recsize with READSIZE 1.5M will work for a while but blows up on 39M bytes in the file (I didn't bother figuring exactly where it stops working in this case). Increasing READSIZE to 5M works again, for 78M bytes in file. But change the definition to have 560 byte records and it blows up. Decrease the file size to 39M bytes and it still won't work with 560 byte records.
    Anyone have any explanation for this behavior? The docs say READSIZE is the read buffer, but only mentions that it is important to the largest record that can be processed - mine are only 280/560 bytes. My table definition is practically taken right out of the example in the docs for fixed length records (change the fields, sizes, names and it is identical - all clauses the same).
    We are going to be using these external tables a lot, and need them to be reliable, so increasing READSIZE to the largest value I can doesn't make me comfortable, since I can't be sure in production how large an input file may become.
    Should I report this as a bug to Oracle, or am I missing something?
    Thanks,
    Bob

    I have an External Table defined with fixed record size, using Oracle 10.2.0.2.0 on HP/UX. At 279 byte records (1 or more fields, doesn't seem to matter), it can read almost 5M bytes in the file (17,421 records to be exact). At 280 byte records, it can not, but blows up with "partial record at end of file" - which is nonsense. It can read up to 3744 records, just below 1,048,320 bytes (1M bytes). 1 record over that, it blows up.
    Now, If I add READSIZE and set it to 1.5M, then it works. I found this extends further, for instance 280 recsize with READSIZE 1.5M will work for a while but blows up on 39M bytes in the file (I didn't bother figuring exactly where it stops working in this case). Increasing READSIZE to 5M works again, for 78M bytes in file. But change the definition to have 560 byte records and it blows up. Decrease the file size to 39M bytes and it still won't work with 560 byte records.
    Anyone have any explanation for this behavior? The docs say READSIZE is the read buffer, but only mentions that it is important to the largest record that can be processed - mine are only 280/560 bytes. My table definition is practically taken right out of the example in the docs for fixed length records (change the fields, sizes, names and it is identical - all clauses the same).
    We are going to be using these external tables a lot, and need them to be reliable, so increasing READSIZE to the largest value I can doesn't make me comfortable, since I can't be sure in production how large an input file may become.
    Should I report this as a bug to Oracle, or am I missing something?
    Thanks,
    Bob

  • Socket and 0x00 byte...

    I've been working on some code to load data using the new
    flash.net.Socket class, but I seem to have a problem with files
    being sliced at '0x00' bytes...
    For example, should I try to send (download) AA BB CC DD EE
    FF 00 11 22, and then query the bytesAvailable, I get 6 as opposed
    to 9, which is the actual packet size...
    Is there a bug with the bytesAvailable getter? Or does the
    socket close on ZERO/NULL bytes... perhaps it may be something
    else?

    Thank you. I have this. Now I would to ask, if it's good way or bad, because receiving side byte array correct receive and success save, because byte[] I am using for file. Problem I have with server, because throw exception --> image. How to repair it. I tried delete row with dos.flush(), but exception is the same. But row 84.
    Error
    // Sending side
              byte[] data = getByteArrayFromInputStream(inputStream);
              DataOutputStream dos = null;
              try {
                   dos = new DataOutputStream(socket.getOutputStream());
                   dos.writeInt(data.length);
                   dos.write(data);
                   dos.flush();
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    // Receiving side
         private void receiveFile() throws IOException {
              DataInputStream dis = null;
              dis = new DataInputStream(clientSocket.getInputStream());
              int length = dis.readInt();
              byte[] b = new byte[length];
              dis.read(b);
              dis.close();
    Edited by: 893807 on 22.4.2012 8:06
    Edited by: 893807 on 22.4.2012 8:11
    Edited by: 893807 on 22.4.2012 8:12

  • Convert.To​Byte and logical masks, from VB to LabVIEW

    Hi guys,
    I have to write a VI communicating via RS232 with a microcontroller for a PWM application. A colleague has given me the GUI he has developpd in VB and I would like to integrate it into my LabVIEW programme by converting the VB code into Labview code.  Here's the code:
    Private Sub LoadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadButton.Click
            Dim bufLen As Integer = 12      // Buffer length
            Dim freq As Integer = 0      // frequency
            Dim pWidth As Integer = 0      // pulse width
            Dim dac As Integer = 0       // Value used in oscillator setting for generating pulse frequency
            Dim addr As Integer = 0      // Address of the pulse width in the pulse generator.
            Dim rTime As Integer = 0      // duration of machining/pulse train in ms.
            Dim returnValue As Byte = 0      // A variable for storing the value returned by the 
                                                           //microcontroller after it receives some data
            Dim buffer(bufLen) As Byte       // creates an array of bytes with 12 cells => buffer size = 8 x12 = 96 bits
    // can you explain a bit please I know you're converting the entered values into byte and put them one by one in a specific order. This order is how the 
    //microcontroller expects them
                addr = (Floor((pWidth - Tinh) / Tinc)) // Formula from hardware, calculates address setting for pulse generator to set pulse width.
                buffer(0) = Convert.ToByte(Floor(3.322 * (Log10(freq / 1039)))) // Caluclates OCT value for use in setting oscillator for pulse freq.
                dac = (Round(2048 - ((2078 * (2 ^ (10 + buffer(0)))) / freq)))  // Calculates DAC value for use in setting oscillator for pulse freq.
                buffer(1) = Convert.ToByte((dac And &HF00) >> 8)                         //
    // &H is the vb.net to tell it its hex code, F00 gives the top 4 bits from a 12 bit value.
                buffer(2) = Convert.ToByte(dac And &HFF) // For values that are larger than 256 (8bits) the value needs to be split across 2 bytes (16 bits) this gets the //bottom 8 bits.  &H is the vb.net to tell it its Hex.
                buffer(3) = Convert.ToByte((addr And &HFF0000) >> 16) // This value may be so large it requires 3 bytes (24bits). This gets the top 8 bits.
                buffer(4) = Convert.ToByte((addr And &HFF00) >> 8) // This gets the middle 8 bits.
                buffer(5) = Convert.ToByte(addr And &HFF)// This gets the bottom 8 bits.
                buffer(6) = Convert.ToByte((rTime And &HFF0000) >> 16) //This value may also be 3 bytes long.
                buffer(7) = Convert.ToByte((rTime And &HFF00) >> 8)
                buffer(8) = Convert.ToByte(rTime And &HFF)
                buffer(9) = Convert.ToByte(2.56 * ocpBox.Value)  // The ocp pulse period is formed of 256 steps or counts, so if a percentage is requested, this formula gives the number of steps/counts required to set the pulse width
                buffer(10) = Convert.ToByte(tempBox.Value)
                If (tempCheck.Checked = True) Then
                    buffer(11) = 1
                Else
                    buffer(11) = 0
                End If
                freq = ((2 ^ buffer(0)) * (2078 / (2 - (dac / 1024))))
                pWidth = Tinh + ((((Convert.ToInt32(buffer(3))) << 16) Or ((Convert.ToInt32(buffer(4))) << 8) Or (Convert.ToInt32(buffer(5)))) * Tinc)
                ' Connect to device
                serialPort1.Write(1) // Sends the number 1. This tells the microcontroller we are about to start sending data. It should respond with a zero if it is ready 
                                             //and the connection is good.
    The line "serialPort1.Write(buffer, 0, bufLen)" sends the buffered data where the variables are: buffer =  the buffered data; 0 = the position in the buffer to start from; bufLen = the position in the buffer to stop sending data.
    What's the best way to deal with the Convert.ToBytes and the logical masks And ??
    Thanks in advance for your time and consideration,
    regards
    Alex
    Solved!
    Go to Solution.

    Try this
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • How to pass and receive byte[] via socket

    Hi All,
    How can I pass a byte[] from client socket to the server socket.
    Also how to receive that bye[] at the server socket.
    Thanks and best Regards,
    - Lasith.

    Hi All,
    Thanks for replying my topic, but still I need some help regarding this.
    My requirement is to have client and server socket programs with following functions (this is bit related to cryptography as well :)).
    First I generate public and private keys for server and in the client side generating a random number and encrypt it with servers public key and sends to server.
    Please refer following code segment.
    SecureRandom random = new SecureRandom();
              long challange = random.nextLong();     
              Cipher cipher = Cipher.getInstance("RSA");
              cipher.init(Cipher.ENCRYPT_MODE, key, new SecureRandom());
                 byte[] cipherText = cipher.doFinal(new Long(challange).toString().getBytes());
                 String cipherTextToServer = cipherText.toString();Then I am passing this string to server socket as follows,
    if(cipherTextToServer !=null)
                   out.println(cipherTextToServer );The server should take this text and decrypt it as follows.
         PrintWriter out = new PrintWriter(client.getOutputStream(),true);
              BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
    while((fromClinet  = in.readLine()) != null){
                   System.out.println("Server -> "+fromClinet);
                   System.out.println("Server -> "+*getDecriptedMassage*(fromClinet,prvKey));
                            out.println(Utility.getDecriptedMassage(massage,prvKey));
         public String getDecriptedMassage(String massage,Key key) throws Exception{
              Cipher cipher = Cipher.getInstance("RSA");
            cipher.init(Cipher.DECRYPT_MODE, key);
            byte[] plainText = cipher.doFinal(massage.getBytes());
            System.out.println("plain : " +new String(plainText));
             return plainText.toString();
         }When running the program I am getting following error.
    Exception in thread "main" java.net.SocketException: Connection reset
         at java.net.SocketInputStream.read(Unknown Source)
         at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
         at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
         at sun.nio.cs.StreamDecoder.read(Unknown Source)
         at java.io.InputStreamReader.read(Unknown Source)
         at java.io.BufferedReader.fill(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at java.io.BufferedReader.readLine(Unknown Source)
         at Client.main(Client.java:46)
    As my investigation if I can remove following code segments then program is working fine.
    System.out.println("Server -> "+*getDecriptedMassage*(fromClinet,prvKey));
    out.println(Utility.getDecriptedMassage(massage,prvKey));So this should be a error when decrypting message. If I am further explaining this the sending encrypted message with client is not same as getting decrypted message on server. Because of this program is giving the error.

  • SCOM 2012 - Event ID 6024 (Launching Restart Health Service. Health Service exceeded Process\Handle Count or Private Bytes threshhold.)

    I am getting event ID 6024 (LaunchRestartHealthService.js : Launching Restart Health Service. Health Service exceeded Process\Handle Count or Private Bytes threshhold.) within an interval ranging from 12-17 minutes.
    I am using SCOM (2012 SP1 and 2012 R2) on Windows Server (2008 R2 / 2012 / 2012 R2).
    This issue is occurring only on agent managed computer (acting as proxy and discover managed objects on other computers setting is enabled) which i am using for monitoring my device. All discovery scripts (powershell) and monitors are targeted on this agent
    managed computer.
    There are total 80 discoveries and 900 monitors. 55 discoveries and 550 monitors are enabled by default and rest all are disabled.
    I am seeing event id 6024 frequently only on agent managed computer. Can anyone help me to resolve this issue.
    Thanks,
    Mukul

    To fix issue 6024, you can follow below steps:
    1. Open SCOM console. Go to Monitors -> Agent -> Entity Health -> Performance -> Health Service Performance -> Health Service State.
    2. Double click Health Service Handle Count Threshold monitor and go to Overrides page.
    3. Click Override -> For a specific object of Class: Agent. Select the affected SCOM agent QMXServer.
    4. Check on the parameter Agent Performance Monitor Type - Threshold. Change the default value 2000 to an appropriate value, like 4000. You can check the Health service handle count alert in SCOM console to get the value when the alert is generated. You
    can also launch the health explorer against QMXServer to check the value when the monitor state is changed from healthy to critical.
    Also you can refer below links
    http://blogs.technet.com/b/omx/archive/2013/10/17/health-service-restarts-on-service-manager-servers-with-scom-agents.aspx
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical | Twitter:
    Mai Ali

  • How do I store an Int, a short, and multiple bytes from file in byte array

    I'm attempting to do this for a project but can't figure out how to store the three values in one byte array. This is what i've tried
    public void send(byte[] input)
              // TODO
              ByteArrayInputStream bais = new ByteArrayInputStream(input);
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              DataOutputStream dos = new DataOutputStream(baos);
              byte[] pData = new byte[100];
              try {
                   dos.writeShort(checkSum);
                   dos.writeInt(nextSeqNum);
                   pData=baos.toByteArray();
                   bais.read(pData);
              } catch (IOException e) {
              DatagramPacket dgp = new DatagramPacket(pData, pData.length);When i set pData=baos.toByteArray() it changes the size and then stops me from being able to read the other 94 bytes into the array to send. Any ideas?

    You don't need the ByteArrayInputStream at all.
    dos.writeShort(checkSum);
    dos.writeInt(nextSeqNum);
    dos.write(input);
    pData = baos.toByteArray();
    When i set pData=baos.toByteArray() it changes the sizeNo, it makes it refer to a new byte[] array containing what you've written to the BAOS. That's what it's supposed to do.

  • Increase UDP sending size over 64k bytes and get error -113,sending buffer not enough

    Dear all,
    I have a case that I must send a data over 64k bytes in a socket with UDP . I got a error-113 shows "A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.".I searched for this issue and got the closest answer as below:
    http://digital.ni.com/public.nsf/allkb/D5AC7E8AE545322D8625730100604F2D?OpenDocument
    It said I have to change buffer size with Wsock.dll. I used the same mathod to increaes the send buffer to 131072 bytes by choice optionname to so_sndbuf (x1001) and give it value with 131072 and it worked fine without error. However I still got an error 113 while sending data with " UDP Write.vi ". It seems UDP write.vi reset the buffer size? Are there any other things cause the error?
    I attached example code. In UDP Sender.vi you can see I change send buffer size to 131072 and send date included a 65536 bytes data.There is also a UDP receiver.vi and there is some missing VI which you can get from the LINK. But it's not necessary.
    Attachments:
    UDP Sender.vi ‏14 KB
    UDP Receiver.vi ‏16 KB
    UDP_set_send_buffer.vi ‏16 KB

    The header for a UDP packet includes a 16 bit field that defines the size of the UDP message (HEADER AND DATA)
    16 bits limits you to a total size of 65635 bytes, minus the header sizes; a minimum of 20 bytes are required to define an IP packet and 8 bytes for UDP leaving an effective data payload of 65507
     bytes.
    LabVIEW is not the issue...
    http://en.wikipedia.org/wiki/User_Datagram_Protocol#Packet_structure
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

Maybe you are looking for

  • Need to automate the process of partial orders-deliveries

    Hi experts, I need to automate the process of partial order deliveries in VL01N. I checked few BAPI for the above requirement. BAPI_OUTB_DELIVERY_CHANGE BAPI_OUTB_DELIVERY_SAVEREPLICA BAPI_OUTB_DELIVERY_CONFIRM_DEC But have no clue ,which would be re

  • How can I make "grunge text" ?

    Using PS cs5 extended with win 7 pro.  I've been trying to figure out how to make grunge (sp?) text.  I figured  I would need to make some type of layer with lines on it, put it above the text and then use a clipping mask.  I don't know how to make t

  • Firefox keeps talking to me. I have already disabled MS Narrator. How do I fix this?

    As I type this question, there is an ad talking to me even though there is nothing on the screen. I have already disabled MS Narrator and checked the settings in Firefox and can't find anywhere to turn OFF this annoying audio. I have Googled the prob

  • HT1338 how to update iWork 9 in mountain lion

    I have iWork 9 that I bought pre app store days, now in Mountain Lion it only upgrades throught the app store and it want's to make me buy them again. Is there a way to upgrade without having to rebuy the same thing I have already bought. I bought th

  • BADI for Backend Scheduling Agreement

    Hi, We have a requirement to create the scheduling agreement instead of contract in R/3 form EBP. Can anybody tell me how to do it. Is there any BADI to do this? Regards, Raveendra Message was edited by:         Raveendra Holla N