CNVString - Sending Strings from a PXI chassis over ethernet to a labWindows application on another computer

I have a PXI chassis with a PXI-8101 controller. It is set up with a realtime operating system. I am communicating to it with a PC with a Windows operating system. I am trying to send variable length string messages from my PXI system to my PC.
On the PC I have a LabWindows application which can send and receive data with the PXI system. I am attempting to send error messages from the PXI system to the PC on ethernet. I am able to send numerical data between them but not the string messages. The PXI software runs to the function call CNVCreateArrayDataValue() and steps into it but never returns. It only has this problem when the parameter CNVDataType is CNVString; when I change CNVDataType to CNVBool it does not have this problem. I am new to this PXI realtime so would appreciate the help. Below is the code on my PXI system which sends these text messages.
In the beginning of RTMain I create the Writer
      CNVCreateBufferedWriter("\\\\localhost\\system\\" REG_CAL_ERROR_STRING, 0, 0, 0, 64, 5000, 0, &gErrorPublisher);
Then I call a function with a string in the parameter list:
void SendRT_ErrorMessage(char* message)
      CNVData data=0;
      int error;
      char error_str[256];
       int i;
      char out_str[ERROR_STRN_SIZE*4];
      strcpy(out_str,message);
      size_t arrayDims= ERROR_STRN_SIZE;
      arrayDims= strlen(message) +1;
      error = CNVCreateArrayDataValue(&data, CNVString, out_str, 1, &arrayDims);
      if(error<0)
            strncpy(error_str, CNVGetErrorDescription(error),256);
//    CNVPutDataInBuffer(gErrorPublisher, data, 1000);
      CNVSetArrayDataValue(data,CNVString,out_str,1,&arrayDims);
      CNVPutDataInBuffer(gErrorPublisher, data, 1000);
      CNVDisposeData(data);
Solved!
Go to Solution.

I've changed things around and now the application on the realtime operating system on the PXI-8101 does not hang but my host computer does not see the message correctly. It sees some characters but they are not what I sent.
I don't seem to be able to get message out of CNVData data properly. Below is the new code for the PXI-8101 controller and the Host computer LabWindows application.
Here is the code in the PXI-8101 controller now:
 CNVCreateWriter("\\\\localhost\\system\\" REG_CAL_ERROR_STRING, 0, 0, 5000, 0, &gErrorPublisher);
void SendRT_ErrorMessage(char* message)
 CNVData data=0;
 int error;
 char error_str[256];
  int i;
 char out_str[ERROR_STRN_SIZE*4];
 strcpy(out_str,message);
 size_t arrayDims= ERROR_STRN_SIZE;
 arrayDims= strlen(message) +1;
 error = CNVCreateScalarDataValue( &data,CNVString,out_str); 
 if(error<0)
  strncpy(error_str, CNVGetErrorDescription(error),256);
 CNVWrite(gErrorPublisher, data, 1000);
 CNVDisposeData(data);
And here is the code in the Host computer LabWindows application:
 sprintf(path, "\\\\%s\\system\\%s", address, REG_CAL_ERROR_STRING);
 CNVCreateSubscriber(path, ErrorMessageCallback, 0, 0, 10000, 0, &gErrorMessageSubscriber);
static void CVICALLBACK ErrorMessageCallback(void * handle, CNVData data, void * callbackData)
 char message[ERROR_STRN_SIZE];
 CNVGetScalarDataValue(data,CNVString,(void *)message);
 (void)SetCtrlVal(panelHandle,PANEL_TEXTBOX_DEBUG_MSG,"got something\n");
 (void)SetCtrlVal(panelHandle,PANEL_TEXTBOX_DEBUG_MSG,message);
 (void)SetCtrlVal(panelHandle,PANEL_TEXTBOX_DEBUG_MSG,"\n");
 CNVDisposeData(data);
You can see that I output a message "got something" so that I know I got the callback but the next line is a gibberish message "HÊl "

Similar Messages

  • I am unable to send photos from iphoto via email as an attachment to be downloaded onto another computer.  i thought e-mail would automatically pick up these photos if mailed out so they could be downloaded.

    At one time I was able to send photos from i photo library and I assumed the receiver could open these and download them into their apple computer (family).
    I have tried to send photos from library or folder as attachment but I am also unable to do this.  How do I send pictures as e-mail attachments which can be opened up and downloaded to another computer?

    I've managed to sort out my own problem!!  Shall write it down in case there are others out there who have a similar problem.   With iPhoto open, click on iPhoto on the top menu bar.  Click on preferences.  Then click on account.  This let me change the details such as the user name and password.  Luckily I played around with a couple of my usual passwords, and found one that worked.  Have now written it down!!!! 

  • HT3231 Is it better to migrate to a new MacBook Pro using FireWire, from Time Machine, or over ethernet?

    Hello,
    Is it better to migrate to a new MacBook Pro (non Retina display) using FireWire, from Time Machine, or over ethernet? The older Mac is a MacBook (Intel, 2007 vintage). The Time Machine backup is to a Western Digital external drive with FireWire & USB ports.
    Thanks!
    Chips

    Thanks for the helpful reply.
    After posting, I read & researched further. We're going to be limited by the hardware – the MacBook & external drive both have FireWire 400, & we don't have a 400 to 800 cable or adapter. So we'll connect by ethernet, & be patient that it make take some time.
    I have to assume that Migration Assistant will be just as comprehensive regardless of the connection method / protocol.
    Best!

  • HELP! I need to be able to remove power from a PXI chassis and replace a card without rebooting the whole system

    I do not have particulars on the controller, but I am sure it's an NI chassis
    and NI regular controller that has a serial cable leading back to the PC.
    I am making this PXI rack into a debug rack for instrument cards,
    so I need to be able to remove power from just the PXI chassis
    and then replace the card with another one
    or the same one and then turn the power back on and restart a
    diagnostic test on the card WITHOUT
    having to reboot the PC.
    Is there a PCIe bridge setup that would allow me to do this?
    Is there software that I need that can accomplish this?

    Yes
    The Chassi is a NI PXI 1045
    and the controller is a NI-PXI-8331
    Let me re-enumerate my requirements:
    Background:
    I have a number of NI cards as well as other manufactured cards in the system.
    One of these cards in the NI system is considered to be a UUT.
    That is, I am using the NI card cage system and other cards in the system to test a CARD
    during a manufacturing test of said UUT CARD.
    The UUT uses a PLX 9030 for it's PCI interfacing.
    This UUT is not designed for hot swap, and I do not bieleve it is plug and play.
    Requirement:
    1. I need to be able to shut off the chassis and remove the UUT when the test finishes, replace the tested UUT
    with a unknown UUT, re-apply power and then test the new UUT WITHOUT having to reboot the PC.
    I have tried several things, such as disabling the PCIe busses in the windows control panel, and then removing power
    replacing the UUT with the next one, re-applying chassis power and then re-enabling the bus and SOMETIMES it works.
    I need a very robust way to do this.
    I also bought a CHROMA PXI-52906-E extender card with bus switches on it, so that I can remove power to the UUT
    without shutting off the chassis. The card is supposedley designed so that when power is re-applied to the UUT, the necessary
    signals to boot the PXI PCI interface is conducted, but I think something else has to be written to the card's PCI registers.
    I am by no means an expert in PCI/PXI, 
    but I seem to have exhausted all of my reserach online in how to meet my requirements.
    Perhaps there is a way for the NI8331 controller to capture PCI configuration data to the card's on system boot,
    and then "replay it" to my UUT after I re-apply power to the UUT?
    Or perhaps PLX makes such a tool?
    Any ideas?

  • Anyone out there successfully migrated from 10.4.11 over ethernet?

    Here's my problem thus far:
    I've got a MBP running 10.4.11 with the latest download of the migration assistant. I've got a new late 2008 MacBook running 10.5.5. I can get migration assistant running on both connected by ethernet and airport is off on both laptops. The MBP sees the MB over the ethernet. I enter in the pass code that the migration assistant lists on the MB and then the MBP goes back into "search for computers" mode and then asks for the pass code again. After I enter the number a second time, the MBP goes back into search mode and this goes on for about 5-10 more minutes until the migration assistant on the MB tells me that there was a network error and it can't work.

    Apple DID A HUGE MISTAKE when omitted Firewire for no reason from the new MacBooks and this becomes evident when trying to migrate user acounts to the new macine from old ones. Apple tried AND FAILED to implement a Migration Assistant that works over network because the whole idea of the original Migration/Setup Assistant became the exact opposite: a painful troubleshooting nightmare, taking hours if not days without success.
    Before any "genie" here asks, I want to point out that all the updates are on my old machines (yes, after finding out the huge problems with this new Migration Assistant 1.2.3 and 1.0.6, I actually tried from 2 old machines, a Mac Mini and a MacBook Pro, as well).
    Looking at Console one could find out that the problem lies deeper than the two machines not being able to find each other over the network - connection goes through within 1-2 sec, but after that there are numerous problems on the old machine, see below. That is why I say Apple really screwed us (and up) with this Migration Assistant v.1.0.6.
    I copy the Console output here and mark with **???** where there are visible errors in the implementation (SantaRosaBook is the old MacBook Pro and SilverBook is the new MacBook):
    Dec 27 13:48:04 SantaRosaBook authexec: executing /Applications/Utilities/Migration Assistant.app/Contents/Resources/MigrateTool
    2008-12-27 13:48:04.154 Migration Assistant[619] serverProxy is nil **???**
    2008-12-27 13:48:05.160 MigrateTool[621] tmp dir path = /private/var/tmp/folders.0/TemporaryItems
    2008-12-27 13:48:28.525 Migration Assistant[619] Could not find image named 'NSNetwork'. **???**
    2008-12-27 13:48:28.552 MigrateTool[621] Asking MT to clean network config **???**
    2008-12-27 13:48:28.602 MigrateTool[621] racoon is not a running process. **???**
    2008-12-27 13:49:20.146 Migration Assistant[619] (BB) Found service [SilverBook]
    2008-12-27 13:49:20.228 Migration Assistant[619] (BB) Resolved service [SilverBook]
    2008-12-27 13:49:20.230 Migration Assistant[619] Machine: willEnterPane F>
    2008-12-27 13:49:20.230 Migration Assistant[619] (BB) Couldn't allocate port for [SilverBook] **???**
    2008-12-27 13:49:20.231 MigrateTool[621] Asking MT to clean network config **???**
    2008-12-27 13:49:20.238 MigrateTool[621] racoon is not a running process. **???**
    2008-12-27 13:50:20.256 Migration Assistant[619] (BB) Successfull DO Connection Established to [SilverBook]
    2008-12-27 13:50:20.256 Migration Assistant[619] Machine : currentMachineChanged: <NSNetService 0x496060> local. apsmigration.tcp. SilverBook
    2008-12-27 13:50:20.272 Migration Assistant[619] (BB) TXT Record changed for service [SilverBook] - data : {model = <636f6d2e 6170706c 652e6d61 63626f6f 6b2d6661 3038>; version = <31>; }
    2008-12-27 13:50:35.728 Migration Assistant[619] passcode = '0', length = 1
    2008-12-27 13:50:36.776 Migration Assistant[619] passcode = '03', length = 2
    2008-12-27 13:50:38.992 Migration Assistant[619] passcode = '036', length = 3
    2008-12-27 13:50:39.536 Migration Assistant[619] passcode = '0369', length = 4
    2008-12-27 13:50:40.352 Migration Assistant[619] passcode = '03693', length = 5
    2008-12-27 13:50:41.296 Migration Assistant[619] passcode = '036938', length = 6
    2008-12-27 13:50:41.305 Migration Assistant[619] Machine: willExitPane F>
    2008-12-27 13:50:55.977 Migration Assistant[619] (BB) NFS mount share point : SantaRosaBook
    2008-12-27 13:50:56.100 Migration Assistant[619] (Progress) remote side notified
    2008-12-27 13:50:56.100 MigrateTool[621] (Tool) setting NFS/IPSec
    2008-12-27 13:50:56.100 MigrateTool[621] (Sleep) prevent machine to sleep
    No matching processes were found **???**
    2008-12-27 13:50:56.150 Migration Assistant[619] Forwarding Notification : SMNetworkStatus
    2008-12-27 13:50:56.150 Migration Assistant[619] (Progress) : Starting secure connection…
    2008-12-27 13:50:56.222 Migration Assistant[619] Forwarding Notification : SMNetworkStatus
    2008-12-27 13:50:56.222 Migration Assistant[619] (Progress) : Starting secure connection…
    2008-12-27 13:50:56.240 Migration Assistant[619] Forwarding Notification : SMNetworkStatus
    2008-12-27 13:50:56.240 Migration Assistant[619] (Progress) : Preparing information…
    2008-12-27 13:50:56.241 MigrateTool[621] (NM) PathAnalyser on port 1234
    2008-12-27 13:50:56.304 MigrateTool[621] Looking for system packages
    Up until this point the new machine could not find a stable connection with the old one, while the old one prompted twice for the password and started to find connection a second time.
    It would be really helpful if somebody from Apple Tech Services could identify the problems and reply or ask for further information. I would be happy to provide further Console messages if that helps.

  • How do I import a project from an external harddrive so that I can continute working on another computer?

    I have been working on a project on my iMac but had to continue work somewhere else on a friends MacBookPro. I copied all the relevant files on an external hardrive but there is not enough space on my friends computer to import the files there. My external is connected with firewire so I want to work with my files still on the external. But I cannot figure out how to do this. I've done some searches but haven't found the right answer.
    I have all the folders as they were on my iMac, i just need FCP X to change where it looks for projects and events.
    Please help.
    Thanks!

    For better performance, all your projects, events and media should be on a fast external Hard Drive (formatted Mac OS Extended - journaled is not important for video) and not on the system drive.
    Your friends MacBook Pro should pick up the events and projects OK - if not, download Digital Rebellion's Preference Manager (free, simple to use, and perfectly safe, both to download and use).
    If this fails, try creating a new (admin) user on the MBP and run FCP X from there with the Hard Drive connected and running.
    Andy

  • Cannot change settings from AAC to MP3 encoder although able to do so on another computer

    I am frustrated as I am able to change my settings on ITunes 10 on my desktop computer, but when I downloaded ITunes10 on my notebook, I was not able to change the same settings from AAC to MP3 encoder although I clicked ok. It keeps reverting to AAC, and I am not able to rightclick my music file, as I can do on my desktop, to create a smaller mp3....
    I also noticed that other checkmarks, i.e. checking "podcast" under general preferences under source revert back to unchecked when I get out.
    What to do?
    Thanks so much,
    Anita

    andreafromspringfield gardens wrote:
    And what does "in the Enterprise" mean?
    In a school / business / corporate environment. Used for a large deployement of iPads.
    http://www.apple.com/support/ipad/enterprise/

  • Send data from c# to flash

    Hi,
    I know that is possible to send strings from and to flash in
    c# with the fscommand-function.
    But is it possible to send a kind of dataset or array(list)
    to flash?
    Grtz
    Annihil8

    >>Are you hosting a flash player within a c/c++
    program?
    No, they are seprate bascially i am trying to send data to a
    seprate c/c++ file.
    >>need more info about what you're trying to do
    >>and why before we can give you an answer
    I have liitle flash programme that I have built that acts
    like a language book (something for GCSE revision) for french and
    german (so far i have only built the german). Because you have to
    type in your oen answer, it had to be long term so i couldn't use
    Shared Objects and so i wanted flash to create a new file so
    on the owners pc as i don't really have that much mermory on my
    server. I know that flash was not able to create a file so i looked
    at different scripts.
    I have not decided weather it will be downloaded or it runs
    in a pop - up browser or in the browser; so i want to keep it as a
    .swf for now. I knew that c/c++ did what i want but how do you get
    it onto the server and work? (i decided i have to get it working on
    the server first before i do anthing else).
    EDIT: just remembering something. flash is going to send an
    array to c++ which will write over that array in file. I probabl
    have separate all the arra that is going to be edited?
    Thanks for your reply as well
    at least it looks like one person knows of
    c/c++

  • Send email from j2me through servlet

    Hi people,
    i hope you can help me because i am new in network programming.
    I am trying to send email from j2me to googlemail account I have 2 classes EmailMidlet (which has been tested with wireless Toolkit 2.5.2 and it works) and the second class is the servlet-class named EmailServlet:
    when i call the EmailServlet, i get on the console:
    Server: 220 mx.google.com ESMTP g28sm19313024fkg.21
    Server: 250 mx.google.com at your service
    this is the code of my EmailServlet
    import java.io.*;
    import java.net.Socket;
    import java.net.UnknownHostException;
    import java.text.*;
    import java.util.Date;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class EmailServlet extends HttpServlet {
       public void doPost(HttpServletRequest request, HttpServletResponse response)
             throws IOException, ServletException {
          System.out.println("____emailservlet.doPost");
          response.setContentType("text/plain");
          PrintWriter out = response.getWriter();
          System.out.println("______________________________");
          out.println();
          String to = request.getParameter("to");
          System.out.println("____________________________to" + to);
          String subject = request.getParameter("subject");
          String msg = request.getParameter("msg");
          // construct an instance of EmailSender
          System.out.println("servlet_to" + to);
          send("[email protected]", to, subject, msg);
          out.println("mail sent....");
       public void send(String from, String to, String subject, String msg) {
          Socket smtpSocket = null;
          DataOutputStream os = null;
          DataInputStream is = null;
          try {
             smtpSocket = new Socket("smtp.googlemail.com", 25);
             os = new DataOutputStream(smtpSocket.getOutputStream());
             is = new DataInputStream(smtpSocket.getInputStream());
          } catch (UnknownHostException e) {
             System.err.println("Don't know about host: hostname");
          } catch (IOException e) {
             System.err
                   .println("Couldn't get I/O for the connection to: hostname");
          if (smtpSocket != null && os != null && is != null) {
             try {
                os.writeBytes("HELO there" + "\r\n");
                os.writeBytes("MAIL FROM: " + from + "\r\n");
                os.writeBytes("RCPT TO: " + to + "\r\n");
                os.writeBytes("DATA\r\n");
                os.writeBytes("Date: " + new Date() + "\r\n"); // stamp the msg
                                                    // with date
                os.writeBytes("From: " + from + "\r\n");
                os.writeBytes("To: " + to + "\r\n");
                os.writeBytes("Subject: " + subject + "\r\n");
                os.writeBytes(msg + "\r\n"); // message body
                os.writeBytes(".\r\n");
                os.writeBytes("QUIT\r\n");
                // debugging
                String responseLine;
                while ((responseLine = is.readLine()) != null) {
                   System.out.println("Server: " + responseLine);
                   if (responseLine.indexOf("delivery") != -1) {
                      break;
                os.close();
                is.close();
                smtpSocket.close();
             } catch (UnknownHostException e) {
                System.err.println("Trying to connect to unknown host: " + e);
             } catch (IOException e) {
                System.err.println("IOException: " + e);
       } 1.when i print "to" in EmailServlet also:
      String to = request.getParameter("to");
          System.out.println("____________________________to" + to);  it show null on the console :confused:
    2. ist this right in case of googlemail.com?
      smtpSocket = new Socket("smtp.googlemail.com", 25);  I would be very grateful if somebody can help me.

    jackofall
    Please don't post in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I'm locking this thread now.
    db

  • NI System Monitor. PXI chassis info? Where?

    I am trying to update my system to LV 14 from 12.  However I used the NI System Monitor to read various temperatures and items from my PXI chassis.  It seems that the installer for NI System Monitor only works up through LV 12?  Is there a replacement?  Has this useful tool just been dropped?  Did NI just forget to update it for 2 years?
    http://www.ni.com/download/ni-system-monitor-1.2.0​/3550/en/
    Solved!
    Go to Solution.

    Jeff·Þ·Bohrer wrote:
    I'm with the blue bars on this Scott.  The system configuration API is the way to go.
    I am fine with the "Blue Bars".  Or any decent bar or brew pub, but the Documentation then should mention that for newer versions the functionality have been superseded or replaced with the "System Configuration" API.  I don't mind switching API, but a little pointer on the road map goes a long way in helping one stay on track.  Especially for those of us who sometims leap frog versions!

  • Sending mail from an EJB

    Hi,
    I tried to send an EMail using javamail from a stateless session bean.
    But my authenticator is not called when running in a bean, and so I get
    an
    DEBUG SMTP RCVD: 550 Relaying is prohibited
    error.
    Running the same code in an standalone application works fine.
    I am using SP3.
    Any Ideas?
    Thank you in advance.
    Johannes
    My code:
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    import javax.mail.*;
    import javax.mail.internet.*;
    import de.zdf.qmv.reiseinfo.util.*;
    import javax.naming.*;
    public class EMailer {
    public class EMailAuthenticator extends Authenticator {
    PasswordAuthentication pa;
    EMailAuthenticator(String username, String passwd) {
    pa = new PasswordAuthentication(username, passwd);
    protected PasswordAuthentication getPasswordAuthentication() {
    return pa;
    static EMailer emailService = new EMailer();
    private void send(String from, String to, String subject, String text)
    throws NamingException, AddressException, MessagingException {
    String mailhost = "mail.xyz.de";
    String cc = null, bcc = null, url = null;
    String mailer = "msgsend";
    String protocol = null, host = null;
    boolean debug = true;
    Properties props = new Properties();
    if (mailhost != null)
    props.put("mail.smtp.host", mailhost);
    String user = "user";
    String passwd = "passwd";
    EMailAuthenticator auth = new EMailAuthenticator(user, passwd);
    props.put("mail.smtp.auth", "true");
    props.put("mail.transport.protocol","smtp");
    props.put("mail.user",user);
    props.put("mail.passwd",passwd);
    Context initial = new InitialContext();
    Session session = (Session) initial.lookup(JNDINames.MAIL_SESSION);
    session = session.getInstance(props, auth);
    Properties prop = session.getProperties();
    prop.list(System.out);
    if (debug) session.setDebug(true);
    // construct the message
    Message msg = new MimeMessage(session);
    if (from != null)
    msg.setFrom(new InternetAddress(from));
    else
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to,
    false));
    if (cc != null)
    msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc,
    false));
    if (bcc != null)
    msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(bcc,
    false));
    msg.setSubject(subject);
    if (text!=null) {
    MimeMultipart mp = new MimeMultipart();
    MimeBodyPart b1 = new MimeBodyPart();
    b1.setContent(text, "text/plain");
    mp.addBodyPart(b1);
    msg.setContent(mp);
    msg.saveChanges();
    msg.setHeader("X-Mailer", mailer);
    msg.setSentDate(new Date());
    Transport.send(msg);
    }

    The mail.jar deliverd by iplanet was not up to date. Now I use release 1.1.3
    and it works.
    Johannes
    "Johannes" <[email protected]> schrieb im Newsbeitrag
    news:[email protected]...
    Hi,
    I tried to send an EMail using javamail from a stateless session bean.
    But my authenticator is not called when running in a bean, and so I get
    an
    DEBUG SMTP RCVD: 550 Relaying is prohibited
    error.
    Running the same code in an standalone application works fine.
    I am using SP3.
    Any Ideas?
    Thank you in advance.
    Johannes
    My code:
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    import javax.mail.*;
    import javax.mail.internet.*;
    import de.zdf.qmv.reiseinfo.util.*;
    import javax.naming.*;
    public class EMailer {
    public class EMailAuthenticator extends Authenticator {
    PasswordAuthentication pa;
    EMailAuthenticator(String username, String passwd) {
    pa = new PasswordAuthentication(username, passwd);
    protected PasswordAuthentication getPasswordAuthentication() {
    return pa;
    static EMailer emailService = new EMailer();
    private void send(String from, String to, String subject, String text)
    throws NamingException, AddressException, MessagingException {
    String mailhost = "mail.xyz.de";
    String cc = null, bcc = null, url = null;
    String mailer = "msgsend";
    String protocol = null, host = null;
    boolean debug = true;
    Properties props = new Properties();
    if (mailhost != null)
    props.put("mail.smtp.host", mailhost);
    String user = "user";
    String passwd = "passwd";
    EMailAuthenticator auth = new EMailAuthenticator(user, passwd);
    props.put("mail.smtp.auth", "true");
    props.put("mail.transport.protocol","smtp");
    props.put("mail.user",user);
    props.put("mail.passwd",passwd);
    Context initial = new InitialContext();
    Session session = (Session) initial.lookup(JNDINames.MAIL_SESSION);
    session = session.getInstance(props, auth);
    Properties prop = session.getProperties();
    prop.list(System.out);
    if (debug) session.setDebug(true);
    // construct the message
    Message msg = new MimeMessage(session);
    if (from != null)
    msg.setFrom(new InternetAddress(from));
    else
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to,
    false));
    if (cc != null)
    msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc,
    false));
    if (bcc != null)
    msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(bcc,
    false));
    msg.setSubject(subject);
    if (text!=null) {
    MimeMultipart mp = new MimeMultipart();
    MimeBodyPart b1 = new MimeBodyPart();
    b1.setContent(text, "text/plain");
    mp.addBodyPart(b1);
    msg.setContent(mp);
    msg.saveChanges();
    msg.setHeader("X-Mailer", mailer);
    msg.setSentDate(new Date());
    Transport.send(msg);

  • How can i send music from iPhone to iPhone?

    How can  i send music from iphone to iphone?

    Hi You cannot do this to another iPhone with a different apple id Your music is linked to your Apple ID . Cheers Brian

  • No CD BURNER on current computer--can I burn from another computer?

    I would love to download more purchasable music via itunes, but my current computer that I use itunes from has no CD burner. If I download itunes to ANOTHER computer and login to my current account, will I be able also download my purchased music to THAT computer and burn to a CD? Hitherto, I've only downloaded one CD because I don't know the answer to this question.
    sUch a rook, arent' I?
    PC   Windows XP Pro  

    You can't re-download on the second computer, because the iTMS allows only 1 download.
    You can login at the iTMS at another computer using your current ID.
    Transfer your purchased music using an external HD or USB memory stick.
    Authorize your second computer and you can burn the purchased songs there.
    M
    P.S. If you run in to an specific Windows problem, you will get more help in the iTunes for Windows forum (you have posted in the Mac forum).

  • Sending Strings Over GKSession - How to stop some craziness?

    Sounds simple, right? But the tricky part is I am trying to retain the header structure from GKTank... I am quite desperate for help at this point as I've been flailing around on this all day and all night....
    All my other events use this structure already and work just fine..and after a ton of trial and error I'm very close... hoping I can get one of you experts to take a look. The issue is that when my strings are less than 8 characters, the results get very strange....
    Here's the relevant code: (kMaxPacketSize is a constant of 1024)
    To send Data: (this is straight from GKTank, actually)
    - (void)sendNetworkPacket:(GKSession *)session packetID:(int)packetID withData:(void *)data ofLength:(int)length reliable:(BOOL)howtosend {
    static unsigned char networkPacket[kMaxPacketSize];
    const unsigned int packetHeaderSize = 2 * sizeof(int); // we have two "ints" for our header
    if(length < (kMaxPacketSize - packetHeaderSize)) { // our networkPacket buffer size minus the size of the header info
    int *pIntData = (int *)&networkPacket[0];
    // header info
    pIntData[0] = packetNumber++;
    pIntData[1] = packetID;
    // copy data in after the header
    memcpy( &networkPacket[packetHeaderSize], data, length );
    NSData *packet = [NSData dataWithBytes: networkPacket length: (length+8)];
    if(howtosend == YES) {
    [session sendDataToAllPeers:packet withDataMode:GKSendDataReliable error:nil];
    } else {
    [session sendDataToAllPeers:packet withDataMode:GKSendDataUnreliable error:nil];
    In this particular case, I began by calling the above method thusly:
    NSString *myText = self.myLabel.text
    NSInteger len = [myText length];
    [self sendNetworkPacket:mySession packetID:NETWORKTEXTEVENT withData:myText ofLength:(len*2)+1 reliable:YES];
    and unwrapping like this on the other end:
    NSString *pStringData = (NSString *)&incomingPacket[8];
    Works like a charm... strings show up just fine on the other device.... except when the string is less than 8 characters...this causes crashes of EXCBADACCESS on the receiving device. When I check values for these short strings prior to sending over GKSession, the memcpy command does not properly embed the string into 'networkPacket' and keeps remnants from the last string that was transmitted.
    So, in an attempt to work around what is probably a flaw in my logic, I decided to see what happens if I pad the beginning and end of these short strings to make them over 8 characters, by defining another string 'spacer' and then sending a padded string instead of myText:
    NSString *spacer = @"zZzZ";
    NSString *bufText = [spacer stringByAppendingString:[myText stringByAppendingString:spacer]];
    len = [bufText length];
    [self sendNetworkPacket:mySession packetID:NETWORKTEXTEVENT withData:bufText ofLength:(len*2)+1 reliable:YES];
    This got rid of the issues with memcpy, and now all strings are embedded in 'networkPacket' properly, some just have the spacers on the beginning and end... no problem, right? I figured I'd just filter out the spacers on the other end, but guess what? I have even tried using the same code to disassemble the packet, prior to sending it, exactly the way I do on the receiving device... it disassembles fine, and I can re-create the string from the raw packet I send....
    However... (and this ONLY happens on the strings that have been padded) when I receive the data through GKSession I get totally random characters and even lengths! Sometimes I get odd system strings like 'tpenable' or 'uni0164' ... it's so bizarre... I don't understand what is making the padded strings get treated differently.... I tried padding all strings just to check and then they all act like this when transmitted... and again when I use the following code, prior to sending the packet, both test1 and test2 look fine:
    NSString *test1 = (NSString *)&networkPacket[8];
    unsigned char *testPacket = (unsigned char *)[packet bytes];
    NSString *test2 = (NSString *)&testPacket[8];
    NSLog (@"netPacket");
    NSLog (test1);
    NSLog (@"Packet");
    NSLog (test2);
    If you have any ideas, I'd really appreciate it!
    Message was edited by: Tech Guru

    [dataString bytes] returns a +const void*+ type. The compiler is complaining because you passed that +const void*+ pointer to a method that declared the 3rd arg to be a void*. The difference between the two pointers is that the first type doesn't want you to change the bytes that it's pointing to, while the second type doesn't care.
    For example:
    - myMethod:(const char *)foo {
    foo[3] = 'A'; // changing the value of the 4th byte at address foo
    In the above, the compiler should warn that your method changed the data which was referenced by a const char* type.
    But sendNetworkPacket doesn't do anything naughty like the above, it just copies the data at the given addy into a buffer. So you could have declared the data param as const void* like this:
    - (void)sendNetworkPacket:(GKSession *)session packetID:(int)packetID withData:(const void *)data ofLength:(int)length reliable:(BOOL)howtosend;
    The above change should get rid of the warning. If the compiler thinks you're changing that data in sendNetworkPacket (we know you're not doing that, but it's hard to argue with a compiler), you'll then get a new warning to that effect. In that case you might as well put a type cast in the call. I.e. take 'const' back out of the method declaration, and cast the arg in the call like this:
    [self sendNetworkPacket:mySession packetID:NETWORKTEXTEVENT withData:(void*)[dataString bytes] ofLength:len reliable:YES];
    The first try is preferable, since we like to avoid type casts, and since (I assume) sendNetworkPacket really doesn't want to change that data. But if the compiler won't cooperate, the second way will always work for you.
    Btw, putting the text into a NSData object is fine by me, but you could've also used any number of NSString methods that aren't deprecated (e.g. [myText UTF8String]). No need to go there now though. I'm guessing your early problems with some perfectly good methods were due to data type glitches. Because of mismatched data types, you may have abandoned the correct approach and gone down the wrong path.
    Once things got to the point where a NSString pointer was sent to memcpy, I think all of us were at risk of falling into darkness. I stared at the code for a very long time, wondering if everyone in the World but me knew that trick. Next time you get a data type error, maybe post the code here and let us try and help out while the problem is still easy to solve, ok?
    All the best,
    Ray

  • How to send a SQUARE WAVE to PXI-6259 over the LAN

    howcan I  send a SQUARE WAVE  to PXI-6259 over the LAN, is
    there any example or link any one can send me , thanx in advance.

    Dear HaI L,
    I managed to send a test signal (sine wave) to the device by choosing
    the test panel option and choosing Analog output. In the analog output
    I could many channels to choose from. ai0, ai1.ai2 and ai3.
     I did this by right clicking NI PXI-6259, in the NI DAQmx devices
    located in the Devices and Interfaces and choosing test and saw it on
    an Oscilloscope without using the NI DAQ OPC capabilities, and I cannot
    understand this thing.
    1)How can it be possible without  making a NI DAQmx  channel and Variable?
    2) I cannot create any channels in the devices and interfaces located
    in My system but I can create NI DAQmx Global Virtual channels easily
    in Data neighbourhood in the remote system, Plz tell me why?
    3) I  want to create a program and choose a channel to send the
    signal,  can I choose the channel that i create in the remote
    system device ? and if yes how can I choose this ?
    Thanx in advance.
    Sincerely,
    Munir Afzal Bhatti.
    Attachments:
    max.jpg ‏2305 KB

Maybe you are looking for

  • Viewer on second display, but also on main display?

    Hi! I use a MacBook Pro as second display for my iMac. I know that it's possible to show the viewer on a second display but I was asking myself if it is possible to show the viewer on my second display, but also keep the viewer on my main display? So

  • Is there way to get read receipts in mail and do you get non deliverable notifications??

    is there way to get read receipts in mail and do you get non deliverable notifications??

  • BAPI for MIGO

    HI frds, Can any one provide BAPI's for the following scenarios TC:MIGO 1.Goods receipt 2.Flag all the items of the GR 3.In excise Tab, No excise entry (06) to be released 4.In general Tab, to enter the delivery number 5.Post Document PART:B Pass the

  • Restore non 10 OS backup to z-10

    Hello, I have lost my 9300 blackberry but luckliy I have a back up. I am following this KB (KB33322)http://btsc.webapps.blackberry.com/btsc/viewdocument.do?externalId=KB33322&sliceId=2&cmd=displayKC&d... but I don't see the ^ at the bottom of the lin

  • Good Trnsprt Faculty

    Dear Gurus, We may be getting a project with a lot of Transportation involved for which we need to include activities like creating (automatically) Shipment Docs based on route, load and type of truck used and calculate the costing and settlement and