Send tcp using thread

MyRcon2.java
package rconed;
import rconed.Rcon;
import rconed.SourceRcon;
public void run() {
    try {
      String stringShow = null;
      SourceRcon R = new SourceRcon();
      stringShow = R.send(this.ip, this.port, this.password, this.command);
      System.out.println(stringShow);
    }catch (Exception e) {}
public void startServer(int portNumber)
    try
      byte[] buf = new byte[1000];
      DatagramSocket ss = new DatagramSocket(portNumber);
      while (true)
        DatagramPacket ip = new DatagramPacket(buf, buf.length);
        ss.receive(ip);
        String rev=new String(buf,0,ip.getLength());
        StringTokenizer st = new StringTokenizer(rev, "/****/");
        MyRcon2 Send = new MyRcon2();
        Send.ip = st.nextToken();
        Send.port = Integer.parseInt(st.nextToken());
        Send.password = st.nextToken();
        Send.command = st.nextToken();
        Thread t =new Thread(Send);
                                                                 t.start();
    }catch (IOException e){}
  }SourceRcon.java
package rconed;
import rconed.exception.BadRcon;
import rconed.exception.ResponseEmpty;
import java.io.*;
import java.net.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
* User: oscahie (aka PiTaGoRaS)<br/>
* Date: 03-jan-2005<br/>
* Time: 19:11:40<br/>
* version: 0.4<br/>
* Rcon library for Source Engine based games<br/>
public class SourceRcon {
    final static int SERVERDATA_EXECCOMMAND = 2;
    final static int SERVERDATA_AUTH = 3;
    final static int SERVERDATA_RESPONSE_VALUE = 0;
    final static int SERVERDATA_AUTH_RESPONSE = 2;
    final static int RESPONSE_TIMEOUT = 2000;
    final static int MULTIPLE_PACKETS_TIMEOUT = 300;
    static Socket rconSocket = null;
    static InputStream in = null;
    static OutputStream out = null;
     * Send the RCON command to the game server (must have been previously authed with the correct rcon_password)
     * @param ipStr     The IP (as a String) of the machine where the RCON command will go.
     * @param port      The port of the machine where the RCON command will go.
     * @param password  The RCON password.
     * @param command   The RCON command (without the rcon prefix).
     * @return The reponse text from the server after trying the RCON command.
     * @throws SocketTimeoutException when there is any problem communicating with the server.
    public static String send(String ipStr, int port, String password, String command) throws SocketTimeoutException, BadRcon, ResponseEmpty {
        return send(ipStr, port, password, command, 0);
     * Send the RCON command to the game server (must have been previously authed with the correct rcon_password)
     * @param ipStr     The IP (as a String) of the machine where the RCON command will go.
     * @param port      The port of the machine where the RCON command will go.
     * @param password  The RCON password.
     * @param command   The RCON command (without the rcon prefix).
     * @param localPort The port of the local machine to use for sending out the RCON request.
     * @return The reponse text from the server after trying the RCON command.
     * @throws SocketTimeoutException when there is any problem communicating with the server.
    public static String send(String ipStr, int port, String password, String command, int localPort) throws SocketTimeoutException, BadRcon, ResponseEmpty {
        String response = "";
        try {
            rconSocket = new Socket();
            InetAddress addr = InetAddress.getLocalHost();
            byte[] ipAddr = addr.getAddress();
            InetAddress inetLocal = InetAddress.getByAddress(ipAddr);
            rconSocket.bind(new InetSocketAddress(inetLocal, localPort));
            rconSocket.connect(new InetSocketAddress(ipStr, port), 1000);
            out = rconSocket.getOutputStream();
            in = rconSocket.getInputStream();
            rconSocket.setSoTimeout(RESPONSE_TIMEOUT);
            if (rcon_auth(password)) {
                // We are now authed
                ByteBuffer[] resp = sendCommand(command);
                // Close socket handlers, we don't need them more
                out.close(); in.close(); rconSocket.close();
                if (resp != null) {
                    response = assemblePackets(resp);
                    if (response.length() == 0) {
                        throw new ResponseEmpty();
            else {
                throw new BadRcon();
        } catch (SocketTimeoutException timeout) {
            throw timeout;
        } catch (UnknownHostException e) {
            System.err.println("UnknownHostException: " + e.getCause());
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection: "+ e.getCause());
        return response;
    private static ByteBuffer[] sendCommand(String command) throws SocketTimeoutException {
        byte[] request = contructPacket(2, SERVERDATA_EXECCOMMAND, command);
        ByteBuffer[] resp = new ByteBuffer[128];
        int i = 0;
        try {
            out.write(request);
            resp[i] = receivePacket();  // First and maybe the unique response packet
            try {
                // We don't know how many packets will return in response, so we'll
                // read() the socket until TimeoutException occurs.
                rconSocket.setSoTimeout(MULTIPLE_PACKETS_TIMEOUT);
                while (true) {
                    resp[++i] = receivePacket();
            } catch (SocketTimeoutException e) {
                // No more packets in the response, go on
                return resp;
        } catch (SocketTimeoutException timeout) {
            // Timeout while connecting to the server
            throw timeout;
        } catch (Exception e2) {
            System.err.println("I/O error on socket\n");
        return null;
    private static byte[] contructPacket(int id, int cmdtype, String s1) {
        ByteBuffer p = ByteBuffer.allocate(s1.length() + 16);
        p.order(ByteOrder.LITTLE_ENDIAN);
        // length of the packet
        p.putInt(s1.length() + 12);
        // request id
        p.putInt(id);
        // type of command
        p.putInt(cmdtype);
        // the command itself
        p.put(s1.getBytes());
        // two null bytes at the end
        p.put((byte) 0x00);
        p.put((byte) 0x00);
        // null string2 (see Source protocol)
        p.put((byte) 0x00);
        p.put((byte) 0x00);
        return p.array();
    private static ByteBuffer receivePacket() throws Exception {
        ByteBuffer p = ByteBuffer.allocate(4120);
        p.order(ByteOrder.LITTLE_ENDIAN);
        byte[] length = new byte[4];
        if (in.read(length, 0, 4) == 4) {
            // Now we've the length of the packet, let's go read the bytes
            p.put(length);
            int i = 0;
            while (i < p.getInt(0)) {
                p.put((byte) in.read());
                i++;
            return p;
        else {
            return null;
    private static String assemblePackets(ByteBuffer[] packets) {
    // Return the text from all the response packets together
        String response = "";
        for (int i = 0; i < packets.length; i++) {
            if (packets[i] != null) {
                response = response.concat(new String(packets.array(), 12, packets[i].position()-14));
return response;
private static boolean rcon_auth(String rcon_password) throws SocketTimeoutException {
byte[] authRequest = contructPacket(1337, SERVERDATA_AUTH, rcon_password);
ByteBuffer response = ByteBuffer.allocate(64);
try {
out.write(authRequest);
response = receivePacket(); // junk response packet
response = receivePacket();
// Lets see if the received request_id is leet enougth ;)
if ((response.getInt(4) == 1337) && (response.getInt(8) == SERVERDATA_AUTH_RESPONSE)) {
return true;
} catch (SocketTimeoutException timeout) {
throw timeout;
} catch (Exception e) {
System.err.println("I/O error on socket\n");
return false;
}Rcon.java package rconed;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketTimeoutException;
import rconed.exception.BadRcon;
import rconed.exception.ResponseEmpty;
* Rcon is a simple Java library for issuing RCON commands to game servers.
* <p/>
* This has currently only been used with HalfLife based servers.
* <p/>
* Example:
* <p/>
* response = Rcon.send(27778, "127.0.0.1", 27015, rconPassword, "log on");
* <p/>
* PiTaGoRas - 21/12/2004<br>
* Now also supports responses divided into multiple packets, bad rcon password
* detection and other minor fixes/improvements.
* <p/>
* @author DeadEd
* @version 1.1
public abstract class Rcon {
private static final int RESPONSE_TIMEOUT = 2000;
private static final int MULTIPLE_PACKETS_TIMEOUT = 300;
* Send the RCON request. Sends the command to the game server. A port
* (localPort must be opened to send the command through.
* @param localPort The port on the local machine where the RCON request can be made from.
* @param ipStr The IP (as a String) of the machine where the RCON command will go.
* @param port The port of the machine where the RCON command will go.
* @param password The RCON password.
* @param command The RCON command (without the rcon prefix).
* @return The reponse text from the server after trying the RCON command.
* @throws SocketTimeoutException when there is any problem communicating with the server.
public static String send(int localPort, String ipStr, int port, String password, String command)
throws SocketTimeoutException, BadRcon, ResponseEmpty {
RconPacket[] requested = sendRequest(localPort, ipStr, port, password, command);
String response = assemblePacket(requested);
if (response.matches("Bad rcon_password.\n")) {
throw new BadRcon();
if (response.length() == 0) {
throw new ResponseEmpty();
return response;
private static DatagramPacket getDatagramPacket(String request, InetAddress inet, int port) {
byte first = -1;
byte last = 0;
byte[] buffer = request.getBytes();
byte[] commandBytes = new byte[buffer.length + 5];
commandBytes[0] = first;
commandBytes[1] = first;
commandBytes[2] = first;
commandBytes[3] = first;
for (int i = 0; i < buffer.length; i++) {
commandBytes[i + 4] = buffer[i];
commandBytes[buffer.length + 4] = last;
return new DatagramPacket(commandBytes, commandBytes.length, inet, port);
private static RconPacket[] sendRequest(int localPort, String ipStr, int port, String password,
String command) throws SocketTimeoutException {
DatagramSocket socket = null;
RconPacket[] resp = new RconPacket[128];
try {
socket = new DatagramSocket(localPort);
int packetSize = 1400;
InetAddress address = InetAddress.getByName(ipStr);
byte[] ip = address.getAddress();
InetAddress inet = InetAddress.getByAddress(ip);
String msg = "challenge rcon\n";
DatagramPacket out = getDatagramPacket(msg, inet, port);
socket.send(out);
// get the challenge
byte[] data = new byte[packetSize];
DatagramPacket inPacket = new DatagramPacket(data, packetSize);
socket.setSoTimeout(RESPONSE_TIMEOUT);
socket.receive(inPacket);
// compose the final command and send to the server
String challenge = parseResponse(inPacket.getData());
String challengeNumber = challenge.substring(challenge.indexOf("rcon") + 5).trim();
String commandStr = "rcon " + challengeNumber + " \"" + password + "\" " + command;
DatagramPacket out2 = getDatagramPacket(commandStr, inet, port);
socket.send(out2);
// get the response
byte[] data2 = new byte[packetSize];
DatagramPacket inPacket2 = new DatagramPacket(data2, packetSize);
socket.setSoTimeout(RESPONSE_TIMEOUT);
socket.receive(inPacket2);
resp[0] = new RconPacket(inPacket2);
try {
// Wait for a possible multiple packets response
socket.setSoTimeout(MULTIPLE_PACKETS_TIMEOUT);
int i = 1;
while (true) {
socket.receive(inPacket2);
resp[i++] = new RconPacket(inPacket2);
} catch (SocketTimeoutException sex) {
// Server didn't send more packets
} catch (SocketTimeoutException sex) {
throw sex;
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (socket != null) {
socket.close();
return resp;
private static String parseResponse(byte[] buf) {
String retVal = "";
if (buf[0] != -1 || buf[1] != -1 || buf[2] != -1 || buf[3] != -1) {
retVal = "ERROR";
} else {
int off = 5;
StringBuffer challenge = new StringBuffer(20);
while (buf[off] != 0) {
challenge.append((char) (buf[off++] & 255));
retVal = challenge.toString();
return retVal;
private static String assemblePacket(RconPacket[] respPacket) {
String resp = "";
// TODO: inspect the headers to decide the correct order
for (int i = 0; i < respPacket.length; i++) {
if (respPacket[i] != null) {
resp = resp.concat(respPacket[i].data);
return resp;
class RconPacket {
* ASCII representation of the full packet received (header included)
public String ascii = "";
* The data included in the packet, header removed
public String data = "";
* The full packet received (header included) in bytes
public byte[] bytes = new byte[1400];
* Length of the packet
public int length = 0;
* Represents a rcon response packet from the game server. A response may be split
* into multiple packets, so an array of RconPackets should be used.
* @param packet One DatagramPacket returned by the server
public RconPacket(DatagramPacket packet) {
this.ascii = new String(packet.getData(), 0, packet.getLength());
this.bytes = ascii.getBytes();
this.length = packet.getLength();
// Now we remove the headers from the packet to have just the text
if (bytes[0] == -2) {
// this response comes divided into two packets
if (bytes[13] == 108) {
this.data = new String(packet.getData(), 14, packet.getLength() - 16);
} else {
this.data = new String(packet.getData(), 11, packet.getLength() - 13);
} else {
// Single packet
this.data = new String(packet.getData(), 5, packet.getLength() - 7);
MyRcon2.java receive command is
127.0.0.1/****/54321/****/password****/command"
if there are more than 1 commands receive at the same time,
SourceRcon.java line 96 will get error
"Couldn't get I/O for the connection: null"
if i change  line 96 to
System.err.println("Couldn't get I/O for the connection: "+ e.getMessage());
it display
Couldn't get I/O for the connection: Invalid argument: JVM_Bind                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

InetAddress addr = InetAddress.getLocalHost();
byte[] ipAddr = addr.getAddress();
InetAddress inetLocal = InetAddress.getByAddress(ipAddr);
rconSocket.bind(new InetSocketAddress(inetLocal, localPort));Remove those four lines, or at least save yourself some trouble and set inetLocal to null and localPort to zero.
Why do you want to specify a local bind-address and port? It's not usually done.

Similar Messages

  • Sending emails using threads

    i have a situation where i need to send mails using threads concept can any one give an idea to how to proceed coz iam new to threads concept
    Thanks in advance

    i have the code to send mails but i need to send bulk mails around 5000 at a time i am using weblogic 8.1 server with jdk 1.4
    the main issue is mails are sent multiple times to the reciepients while using the code, the reciepients are complaining about this.
    for your reference iam posting the code again
    Message message = new MimeMessage(InvitationSender.session);
    String addrFrom = invitation.getFromEmail();
    String fromName = invitation.getFromName();
    Address fromAddress = new InternetAddress(addrFrom);
    message.setFrom(fromAddress);
    message.setSubject(invitation.getInvitationSubject());
    message.setContent(gMessage.getMessageBody(), invitation.getContentType());
    message.setRecipient(Message.RecipientType.TO, new InternetAddress(eAddr.getAddress(), eAddr.getName()));
    Transport tr = session.getTransport("smtp");
    String host = System.getProperty("host");
    String username = System.getProperty("username");
    String password = System.getProperty("password");
    tr.connect(host, username, password);
    message.saveChanges();
    tr.sendMessage(message, message.getAllRecipients());
    tr.close();
    i have posted the code of the send mail method and all said the code doesnt have any problem and some one suggested me to use threads thats why i am seeking some thoughts on how to do that
    thanks in advance

  • TCP sender, using threads

    Hi everyone, i'm relatively new to threads, so please bear with me.
    i'm trying to write a client program that sends packets using some sort of flow control resembling TCP but not quite, and i'm not sure how to go about it. using a threaded approach, how could i do this:
    loop(forever)
    switch(event)
    event: data received from application above;
        create header and segment;
        start timer;
        send segment;
        break;
    event: timer times out for segment n;
        send segment again;
        break;
    }I'd appreciate any help, but code snippets would be the most helpful. thanks for your time!

    the class needs to either extend Thread or implements Runnable. You can do socket read block inside run method.
    public class SocketListener implements Runnable
      public void run()
           InputStream  in  = socket.getInputStream();
           while(true)
                  //socket read block    
                  in.read();
    }

  • How to use threads to reconnect a socket to a server in TCP/IP

    I want to know how to reconnect a socket to a server in TCP.
    Actually i wanted to do reconnection whenever a SocketException for broken connection etc. is thrown in my code. This I want to do for a prespecified number of times for reconnection in case of broken connection.When this number decrements to zero the program will exit printing some error message. I was planning to use threads by way of having some Exception Listeners but i am not sure How?
    Any suggestions will be really helpful..
    please help.
    Edited by: danish.ahmed.lnmiit on Jan 28, 2008 2:44 AM

    I want to know how to reconnect a socket to a server in TCP.There is no reconnect operation in TCP. You have to create a new Socket.

  • Cannot send message using the server (null)

    i use mail 2.1.
    i have a .mac account and have three other email accounts attached to my mail account.
    lately, i cannot send any email.
    the switchiing ports fix hasn't helped either.
    this is the error message:
    CANNOT SEND MESSAGE USING THE SERVER (null)
    The server response was: 5.1.0 <email [email protected]>...
    From address does not match authentication.
    Use the pop-up menu below to try a different outgoing mail server. All messages will use this server until you quit Mail or change your network settings.
    Message from: email <[email protected]>
    Send message using: [there is a combo box here with all the four accounts servers listed]
    no matter which one i pick it doesn't work and no email is sent.
    anyone have this error before? or now how to fix it?
    i'd be appreciative.
    thanks
    1.67 GHz Power PC PowerBook G4   Mac OS X (10.4.6)   Sony HDR HC3 HD HandyCam MiniDV

    I was having a similar problem (don't feel like typing all the details)
    I was about to to delete my com.apple.mail.plist, when finally it hit me.
    I ran ethereal (again, I'm sorry, but learning how to use ethereal is a topic unto itself). Following the TCP stream (ie. looking at the smtp messages being sent back and forth) I came across two problems. For some reason my port number was set to 567 or something like that, when it's supposed to be 25, as I had originally set it to.
    Once I corrected the port number I started receiving an error message from the smtp server. It said the return email address could not be authenticated. (using xyz.com as an example) The correct return email address was supposed to be [email protected], but for some reason it was changed to john@xyz in the account settings.
    Anyway, to get to the point, another thing to check is that your return address has been set correctly, and if all else fails, make sure you have X11 installed and use fink to install and run ethereal. This will let you know if you are actually connecting to the server, and will show you any error messages.
    PS. I think this problem started occurring with the last update made to mail. I believe it somehow corrupted my settings. This would explain how my port number could have been changed to the default port number of .mac mail.

  • Using threads in a process of two or more tasks concurrently?

    Dear,
    I need to develop through a Java application in a process that allows the same process using Threads on two or more tasks can be executed concurrently. The goal is to optimize the runtime of a program.
    Then, through a program, display the behavior of a producer and two consumers at runtime!
    Below is the code and problem description.
    Could anyone help me on this issue?
    Sincerely,
    Sérgio Pitta
    The producer-consumer problem
    Known as the problem of limited buffer. The two processes share a common buffer of fixed size. One, the producer puts information into the buffer and the other the consumer to pull off.
    The problem arises when the producer wants to put a new item in the buffer, but it is already full. The solution is to put the producer to sleep and wake it up only when the consumer to remove one or more items. Likewise, if the consumer wants to remove an item from the buffer and realize that it is empty, he will sleep until the producer put something in the buffer and awake.
    To keep track of the number of items in the buffer, we need a variable, "count". If the maximum number of items that may contain the buffer is N, the producer code first checks whether the value of the variable "count" is N. If the producer sleep, otherwise, the producer adds an item and increment the variable "count".
    The consumer code is similar: first checks if the value of the variable "count" is 0. If so, go to sleep if not zero, removes an item and decreases the counter by one. Each case also tests whether the other should be agreed and, if so, awakens. The code for both producer and consumer, is shown in the code below:
    #define N 100                     / * number of posts in the buffer * /
    int count = 0,                     / * number of items in buffer * /
    void producer(void)
    int item;
    while (TRUE) {                    / * number of items in buffer * /
    produce_item item = ()           / * generates the next item * /
    if (count == N) sleep ()           / * if the buffer is full, go to sleep * /
    insert_item (item)                / * put an item in the buffer * /
    count = count + 1                / * increment the count of items in buffer * /
    if (count == 1) wakeup (consumer);      / * buffer empty? * /
    void consumer(void)
    int item;
    while (TRUE) {                    / * repeat forever * /
    if (count == 0) sleep ()           / * if the buffer is full, go to sleep * /
    remove_item item = ()           / * generates the next item * /
    count = count - 1                / * decrement a counter of items in buffer * /
    if (count == N - 1) wakeup (producer)      / * buffer empty? * /
    consume_item (item)      / * print the item * /
    To express system calls such as sleep and wakeup in C, they are shown how to call library routines. They are not part of standard C library, but presumably would be available on any system that actually have those system calls. Procedures "insert_item and remove_item" which are not shown, they register themselves on the insertion and removal of the item buffer.
    Now back to the race condition. It can occur because the variable "count" unfettered access. Could the following scenario occurs: the buffer is empty and the consumer just read the variable "count" to check if its value is 0. In that instant, the scheduler decides to stop running temporarily and the consumer starting to run the producer. The producer inserts an item in the buffer, increment the variable "count" and realizes that its value is now 1. Inferring the value of "count" was 0 and that the consumer should go to bed, the producer calls "wakeup" to wake up the consumer.
    Unfortunately, the consumer is not logically asleep, so the signal is lost to agree. The next time the consumer to run, test the value of "count" previously read by him, shall verify that the value is 0, and sleep. Sooner or later the producer fills the whole buffer and also sleep. Both sleep forever.
    The essence of the problem is that you lose sending a signal to wake up a process that (still) not sleeping. If he were not lost, everything would work. A quick solution is to modify the rules, adding context to a "bit of waiting for the signal to wake up (wakeup waiting bit)." When a signal is sent to wake up a process that is still awake, this bit is turned on. Then, when the process trying to sleep, if the bit waiting for the signal to wake up is on, it will shut down, but the process will remain awake. The bit waiting for the signal to wake up is actually a piggy bank that holds signs of waking.
    Even the bit waiting for the signal to wake the nation have saved in this simple example, it is easy to think of cases with three or more cases in which a bit of waiting for the signal to wake up is insufficient. We could do another improvisation and add a second bit of waiting for the signal to wake up or maybe eight or 32 of them, but in principle, the problem still exists.

    user12284350 wrote:
    Hi!
    Thanks for the feedback!
    I need a program to provide through an interface with the user behavior of a producer and two consumers at runtime, using Threads!So hire somebody to write one.
    Or, if what you really mean is that you need to write such a program, as part of your course work, then write one.
    You can't just dump your requirements here and expect someone to do your work for you though. If this is your assignment, then you need to do it. If you get stuck, ask a specific question about the part that's giving you trouble. "How do I write a producer/consumer program?" is not a valid question.

  • Issue  while sending mails using classes

    Hi Experts ,
    i have one issue when i try to send mails using classes cl_document_bcs,cl_cam_address_bcs,cl_bcs etc
    ISSUE :
    i put some data in selection screen and i get some output ( say i got 5 records), i select 3 records and press some button to trigger mail and mail is send, and now again the OUTPUT screen is  shown with  sended records but we can not send these records again ............ now i selcect remaining two records  and press button to trigger mail and THIS TIME MAIL IS NOT SEND.
    amd my code is :
    CREATE OBJECT l_document.
      CREATE OBJECT l_recipient.
      TRY.
          cl_bcs_convert=>string_to_solix(
          EXPORTING
          iv_string = fp_wa_output
          iv_codepage = fp_v_code_page
          iv_add_bom = 'X'
          IMPORTING
          et_solix = l_wa_output_binary
          ev_size = l_v_size ).
          l_send_request = cl_bcs=>create_persistent( ).
    *-->Creating Document
          l_document = cl_document_bcs=>create_document(
          i_type = 'RAW'
          i_text = fp_it_content[]
          i_subject = fp_text_48 ) .
    *-->Adding Attachment*
          CALL METHOD l_document->add_attachment
            EXPORTING
              i_attachment_type    = fp_text_049
              i_attachment_size    = l_v_size
              i_attachment_subject = fp_v_file
              i_att_content_hex    = l_wa_output_binary.
    *-->Add document to send request*
          CALL METHOD l_send_request->set_document( l_document ).
    *    do send delivery info for successful mails
          CALL METHOD l_send_request->set_status_attributes
            EXPORTING
              i_requested_status = 'E'
              i_status_mail      = 'A'.
    *-->Get Sender Object
          l_uname = sy-uname.
          l_sender = cl_sapuser_bcs=>create( l_uname ).
          CALL METHOD l_send_request->set_sender
            EXPORTING
              i_sender = l_sender.
          LOOP AT fp_s_mail INTO l_wa_mail.
            l_v_objid = l_wa_mail-low.
            l_v_mail = l_v_smtpadr.
            TRANSLATE l_v_mail TO LOWER CASE.
            l_recipient = cl_cam_address_bcs=>create_internet_address( l_v_mail ).
            CALL METHOD l_send_request->add_recipient
              EXPORTING
                i_recipient  = l_recipient
                i_express    = 'X' .
    *            i_copy       = ' '
    *            i_blind_copy = ' '
    *            i_no_forward = ' '.
          ENDLOOP.
    **-->Trigger E-Mail immediately*
    *      IF fp_send_all EQ 'X'.
    *        l_send_request->set_send_immediately( 'X' ).
    *      ENDIF.
          CALL METHOD l_send_request->send(
          EXPORTING
          i_with_error_screen = 'X'
            RECEIVING result = l_v_sent_to_all ).
          BREAK TARK.
          IF l_v_sent_to_all = 'X'.
            MESSAGE i000 .
          ENDIF.
        COMMIT WORK.
        CATCH cx_document_bcs INTO l_bcs_exception.
        CATCH cx_send_req_bcs INTO l_send_exception.
        CATCH cx_address_bcs INTO l_addr_exception.
        CATCH cx_bcs INTO l_exp.
      ENDTRY.
    thanks in advance
    rahul

    Every time when i choose other network or dongle to send those mails it gets sent.
    As per the description, seems it's an issue related to this specific network. Probably, they've adjusted their security policy, like blocked some port numbers, etc.
    You might need to contact the support of your ISP to confirm what SMTP settings you need. Check port number, and security settings.
    By the way, this is the forum to discuss questions and feedback for Windows-based Microsoft Office client. Since your query is directly related to
    Office for mac, I would suggest you to post in the forum of
    Office for Mac, where you can get more experienced responses:
    http://answers.microsoft.com/en-us/mac/forum/macoffice2011?tab=Threads
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • I need a timer function to ping the server every 5 secs??using threads.

    I need a timer function to ping the server every 5 secs??
    using threads...i have to use a thread coz i cant use Timer and Timer Task coz clients r on the JDK1.2 version.I have created a thread which keeps checking th ping msg & any server msg is pings 4 the1st time properly but then it just waits to read the response from server but it doesnt but the server shows that it has send the msgs to client???PLEASE HELP URGENT

    Few things are not clear from your post, like, are you using sockets and if you are, how are u reading writing to them (ur sample code would help)...
    Anyways if you are, are you doing accept on your socket in a while(true) loop or just once... If you do it only once you will get the first ping message but none afterwards if the other side closes and opens new sockets for every send... What I am suggesting is something like the following:
    ss = new ServerSocket(port);
    while(true)
         s = ss.accept();
         is = s.getInputStream();
         os = s.getOutputStream();
         reader = new BufferedReader(new InputStreamReader(is));
         writer = new BufferedWriter(new OutputStreamWriter(os));
         String in = reader.readLine();
            // do something with this string
            s.close();
            // put some check here to break out of this infinite loop
    }// end of While

  • Multipe Sender RFC using same Program ID

    Hi all,
    I have RFC>XI>HTTP scenario. All confiruation has been done in R/3 and XI has ben done correctly.
    Is it possible to use the same TCP/IP port Program ID created in SM59 (in R/3) for sending different RFC messages to XI. Meaning, in different XI RFC sender adapter communication channels, can I use the same Program ID.
    When I tried, it work for one RFC, but when multiple RFC sender adapter uses same program ID..RFC program errors out in R/3 itself with error message - Commit fault: com.sap.aii.af.rfc.afcommunication.RfcChannelMismatchExcept.
    Please help.
    Thanks
    Karthik

    Karthik,
    It is possible to send different messages from R3 to XI that use the one RFC destination and Program ID (in R/3) and the one Communication channel (in XI)
    Assume that interfaces AAA and BBB have different structures
    <u><b>SAP R/3</b></u>
    <b>For interface AAA</b>
    (1)     Execute ABAP Z_AAA which
    (2)     Populates the internal table ITAB_AAA with structure ZST_AAA
    (3)     Calls the remote enabled function ZFN_AAA
    (4)     Passes the interface data in the tables statement
    CALL FUNCTION 'ZFN_AAA' DESTINATION RFCCOMMON
             EXPORTING
                  … … …         = … … …
             IMPORTING
                  … … …         = … … …
             TABLES
                  AAA           = ITAB_AAA.
    <b>For interface BBB</b>
    (1)     Eexecute ABAP Z_BBB which
    (2)     Populates the internal table ITAB_BBB with structure ZST_BBB
    (3)     Calls the remote enabled function ZFN_BBB
    (4)     Passes the interface data in the tables statement
    CALL FUNCTION 'ZFN_BBB' DESTINATION RFCCOMMON
             EXPORTING
                  … … …         = … … …
             IMPORTING
                  … … …         = … … …
             TABLES
                  BBB           = ITAB_BBB.
    Each function is called with the same destination RFCCOMMON
    In SM59 point the RFC destination RFCCOMMON to your XI environment and provide a program id, for example ID_COMMON
    <i><b>XI</b></i>
    <b>(1) Configure the sender RFC Communication Channel</b> for example CC_COMMON and enter your SAP R/3 server parameters to include the program id ID_COMMON
    <b>(2) Configure the Receiver Determinations</b> as follows
    For interface AAA
    Sender Service     Enter your SAP R3 Business System for example R3PROD Interface          ZFN_AAA (this is the SAP R/3 remote function)
    Namespace          urn:sap-com:document:sap:rfc:functions
    Configured Receivers     
    Service               Integration Process AAA
    For interface BBB
    Sender Service     Enter your SAP R3 Business System for example R3PROD
    Interface          ZFN_BBB (this is the SAP R/3 remote function)
    Namespace          urn:sap-com:document:sap:rfc:functions
    Configured Receivers     
    Service               Integration Process BBB
    <b>(3) Configure the Sender Agreement</b> as follows
    For interface AAA
    Sender Service     R3PROD
    Interface          ZFN_AAA
    Namespace          urn:sap-com:document:sap:rfc:functions
    Sender CC          CC_COMMON
    For interface BBB
    Sender Service     R3PROD
    Interface          ZFN_BBB
    Namespace          urn:sap-com:document:sap:rfc:functions
    Sender CC          CC_COMMON
    Regards,
    Mike

  • Invocation of SOAP Sender Adapter using Apache SOAP

    Hi,
    I'm trying to invoke the XI SOAP Sender Adapter using the Apache SOAP API. It seems that my message header is missing a few parameters (see exception below). Does anybody know which to set?
    Regards,
    Heiko
    ==========
    Exception:
    <?xml version='1.0'?>
    <!-- see the documentation -->
    <SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
      <SOAP:Body>
        <SOAP:Fault>
          <faultcode>SOAP:Server</faultcode>
          <faultstring>Server Error</faultstring>
          <detail>
            <s:SystemError xmlns:s='http://sap.com/xi/WebService/xi2.0'>
              <context>XIAdapter</context>
              <code>Exception</code>
              <text><![CDATA[
    com.sap.aii.af.mp.module.ModuleException
         at com.sap.aii.af.mp.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:502)
         at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl3.process(ModuleLocalLocalObjectImpl3.java:103)
         at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:227)
         at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0.process(ModuleProcessorLocalLocalObjectImpl0.java:103)
         at com.sap.aii.af.mp.soap.web.MessageServlet.callModuleProcessor(MessageServlet.java:162)
         at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:507)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged1(Native Method)
         at java.security.AccessController.doPrivileged(AccessController.java:321)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
    Caused by: java.lang.Exception: Bubble configuration error: parameter 'XI.InterfaceNamespace' is missing
         at com.sap.aii.af.mp.soap.ejb.XISOAPAdapterBean.getParaRequired(XISOAPAdapterBean.java:895)
         at com.sap.aii.af.mp.soap.ejb.XISOAPAdapterBean.createDefaultMessageHeader(XISOAPAdapterBean.java:942)
         at com.sap.aii.af.mp.soap.ejb.XISOAPAdapterBean.setup(XISOAPAdapterBean.java:214)
         at com.sap.aii.af.mp.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:496)
         ... 22 more
              ]]></text>
            </s:SystemError>
          </detail>
        </SOAP:Fault>
      </SOAP:Body>
    </SOAP:Envelope>

    Hi Heiko,
    You are missing the Namespace Parameter in the sender soap adapter configuration in XI3.0
    Thanks
    Prasad

  • Email send issue using "Mail Server Load balancer"  (Cisco ACE 20)

    Please let me know if someone have experienced this kind of issue or any suggestions.
    The send email action was working file in MII with smtp mail server on port 25. Recently basis did a change in mail server ip address and they installed a new Load Balancer . The Load balancer is between SMTP and MII. After this change MII does not send email (unknown source error). now MII send email action has ip address or qualified path of Load balancer in MII send email configuration instead of direct ip address of SMTP server. Below is the error message in Net Weaver logs.
    MII still sends email if direct ip address of email server  provided but not through email Load balancer .
    Any suggestions ?
    Could not authenticate mail account (Unknown Source)
    [EXCEPTION]
    javax.mail.AuthenticationFailedException
    at javax.mail.Service.connect(Service.java:319)
    at javax.mail.Service.connect(Service.java:169)
    at javax.mail.Service.connect(Service.java:118)
    at com.sap.xmii.storage.connections.MailConnection.sendMail(MailConnection.java:202)
    at com.sap.xmii.bls.executables.actions.mail.MailActions.send(MailActions.java:223)
    at sun.reflect.GeneratedMethodAccessor1412.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.sap.xmii.bls.engine.ReflectiveAction.doExecute(ReflectiveAction.java:747)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseAction.execute(BaseAction.java:76)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runAction(ProductionRunner.java:147)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:50)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Switch.doExecute(Switch.java:131)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:122)
    at com.sap.xmii.bls.executables.controls.Repeater.doExecute(Repeater.java:113)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.RootNode.execute(RootNode.java:39)
    at com.sap.xmii.bls.engine.TransactionInstance.execute(TransactionInstance.java:1001)
    at com.sap.xmii.bls.engine.TransactionInstance.run(TransactionInstance.java:680)
    at com.sap.xmii.bls.executables.actions.logic.LogicActions.transaction(LogicActions.java:310)
    at sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.sap.xmii.bls.engine.ReflectiveAction.doExecute(ReflectiveAction.java:747)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseAction.execute(BaseAction.java:76)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runAction(ProductionRunner.java:147)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:50)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.RootNode.execute(RootNode.java:39)
    at com.sap.xmii.bls.engine.TransactionInstance.execute(TransactionInstance.java:1001)
    at com.sap.xmii.bls.engine.TransactionInstance.run(TransactionInstance.java:680)
    at com.sap.xmii.bls.executables.actions.logic.LogicActions.transaction(LogicActions.java:310)
    at sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.sap.xmii.bls.engine.ReflectiveAction.doExecute(ReflectiveAction.java:747)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseAction.execute(BaseAction.java:76)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runAction(ProductionRunner.java:147)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:50)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:122)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:122)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.RootNode.execute(RootNode.java:39)
    at com.sap.xmii.bls.engine.TransactionInstance.execute(TransactionInstance.java:1001)
    at com.sap.xmii.bls.engine.TransactionInstance.run(TransactionInstance.java:680)
    at com.sap.xmii.bls.executables.actions.logic.LogicActions.transaction(LogicActions.java:310)
    at sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.sap.xmii.bls.engine.ReflectiveAction.doExecute(ReflectiveAction.java:747)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseAction.execute(BaseAction.java:76)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runAction(ProductionRunner.java:147)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:50)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:122)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:151)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:122)
    at com.sap.xmii.bls.executables.controls.Conditional.doExecute(Conditional.java:158)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseControl.execute(BaseControl.java:127)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runControl(ProductionRunner.java:97)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:64)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.RootNode.execute(RootNode.java:39)
    at com.sap.xmii.bls.engine.TransactionInstance.execute(TransactionInstance.java:1001)
    at com.sap.xmii.bls.engine.TransactionInstance.run(TransactionInstance.java:680)
    at com.sap.xmii.bls.executables.actions.logic.LogicActions.transaction(LogicActions.java:310)
    at sun.reflect.GeneratedMethodAccessor387.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.sap.xmii.bls.engine.ReflectiveAction.doExecute(ReflectiveAction.java:747)
    at com.sap.xmii.bls.engine.BaseNode.executeNode(BaseNode.java:198)
    at com.sap.xmii.bls.engine.BaseAction.execute(BaseAction.java:76)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runAction(ProductionRunner.java:147)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:50)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.Sequence.execute(Sequence.java:59)
    at com.sap.xmii.bls.engine.runners.ProductionRunner.runSequence(ProductionRunner.java:126)
    at com.sap.xmii.bls.executables.sequences.RootNode.execute(RootNode.java:39)
    at com.sap.xmii.bls.engine.TransactionInstance.execute(TransactionInstance.java:1001)
    at com.sap.xmii.bls.engine.TransactionInstance.run(TransactionInstance.java:680)
    at com.sap.xmii.Illuminator.connectors.Xacute.XacuteRequestHandler.processQueryRequest(XacuteRequestHandler.java:342)
    at com.sap.xmii.Illuminator.connectors.Xacute.XacuteRequestHandler.QueryRequest(XacuteRequestHandler.java:135)
    at com.sap.xmii.Illuminator.connectors.Xacute.XacuteConnector.doProcessRequest(XacuteConnector.java:86)
    at com.sap.xmii.Illuminator.connectors.AbstractConnector.processRequest(AbstractConnector.java:83)
    at com.sap.xmii.Illuminator.server.QueryEngine.run(QueryEngine.java:41)
    at com.sap.xmii.Illuminator.services.handlers.IlluminatorService.processRequest(IlluminatorService.java:68)
    at com.sap.xmii.Illuminator.services.ServiceManager.run(ServiceManager.java:68)
    at com.sap.xmii.servlet.Illuminator.service(Illuminator.java:68)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at com.sap.xmii.servlet.ServletRunner.run(ServletRunner.java:80)
    at com.sap.xmii.servlet.ServletRunner.run(ServletRunner.java:44)
    at com.sap.xmii.Illuminator.gui.irpt.ReportParser.processServletRequest(ReportParser.java:610)
    at com.sap.xmii.Illuminator.gui.irpt.ReportParser.parseServletTag(ReportParser.java:276)
    at com.sap.xmii.Illuminator.gui.irpt.ReportParser.parseFile(ReportParser.java:154)
    at com.sap.xmii.Illuminator.gui.irpt.ReportParser.parse(ReportParser.java:119)
    at com.sap.xmii.servlet.ReportServlet.service(ReportServlet.java:90)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:162)
    at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:81)
    at com.sap.xmii.system.SecurityFilter.doFilter(SecurityFilter.java:96)
    at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
    at com.sap.xmii.system.SecurityFilter.doFilter(SecurityFilter.java:96)
    at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
    at com.sap.xsrf.filter.XSRFProtectorFilter.doFilter(XSRFProtectorFilter.java:62)
    at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:468)
    at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:298)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:399)
    at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:388)
    at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:48)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:84)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:244)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:78)
    at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
    at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:43)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:42)
    at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
    at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
    at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:428)
    at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:247)
    at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:45)
    at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
    at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
    at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:327)
    Date:
    2014-03-25
    Time:
    14:04:06:176
    Category:
    com.sap.xmii.storage.connections.MailConnection
    Location:
    com.sap.xmii.storage.connections.MailConnection
    Application:
    sap.com/xapps~xmii~ear
    Thread:
    Thread[HTTP Worker [@629095796],5,Dedicated_Application_Thread]
    Data Source:
    j2ee\cluster\server0\log\defaultTrace_00.trc
    Arguments:
    DSR Transaction:

    Have a look at this thread please: 
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f11f3079-b04a-4a8e-b89e-d56eb0532c42/the-mail-could-not-be-sent-to-the-recipients-because-of-the-mail-server-failure-sending-mail-using?forum=sqldatabaseengine
    Saeid Hasani [sqldevelop]

  • Using Threads And Sockets

    Hello,
    I want to create a program that can send 2 or more files through the socket to the same client at the same time. Is it possible? I am trying to use threads to do this but I am not sure what to do in those threads. Should I send the socket to the thread class and create BufferedReader and DataOutputStream again in the thread?
    Also should I create threads in the client-side?
    Thanks
    Edited by: bcaputcu on May 18, 2010 2:19 AM

    bcaputcu wrote:
    Hello,
    I want to create a program that can send 2 or more files through the socket to the same client at the same time. Is it possible?No. At least not in the way you're thinking.
    I am trying to use threads to do this but I am not sure what to do in those threads. Should I send the socket to the thread class and create BufferedReader and DataOutputStream again in the thread?No, because you can't do that. The socket won't create multiple streams for your threads.
    Also should I create threads in the client-side?No.
    You need to send the files one at a time. While you could basically send the data interleaved, it would still only involve only one thread, one socket and one set of streams. And it would be a silly thing to do.

  • Using thread and socket connection with other machines

    Hi all!
    we are using weblgoic 5.1 SP9 JDK1.2.2
    we already using java.net.Socket and java.lang.Thread
    to communication TANDEM Machine on the weblogic.
    the reason why we use to socket and thread even though it is not
    recommanded is that below
    1. once we connect Socket, then we using until server shutdown or
    connection may has the problem, so we're using thread to wait
    java.io.Inputstream to read from socket.(if I using EJB, It can't
    wait socket inputstream indefinetly, because it has timeout)
    2. we're logging Database date sent or received with TANDEM Machine.
    so we need Database Access. so we using Database Access
    thru Weblogic.
    3. EJB Application using (other EJB Application - send Module)
    to send data to TANDEM Machine. So "Send Module" should
    be implemented EJB.
    but. Now I see there might be problem this framework.
    so, is there some way by just using J2EE spec, to implement this kind of
    framework.
    wait for your great help !!
    regards.

    Yes i've tried interrupt method and it doesn't have any effects on the thread... it stay in connect() method...
    And for the timeouts, in fact i use an API : J2SSH, to connect with SSH protocol, and the setting of connection timeouts is not implemented yet... and the default timeout is about 4 minutes...
    so i don't know how to solve this problem...

  • Intermittent "Cannnot send message using the server" error

    I've been getting an intermittent "Cannnot send message using the server" error for a couple of months now. It happens every 3 or 4 e-mails I try to send or reply to. I select "Try Again Later" and then open the message from the Outbox and resend with no problem.
    My setup is;
    Mail 2.1.1
    OSX 10.4.9
    MacBookPro
    CableVision is my provider
    It's a POP account
    My incoming server is pop.secureserver.net
    My outgoing server is smtpout.secureserver.net
    Server port 3535
    Authentication - Password
    SSL is off
    Any help would be appreciated

    Hi Dave, and a warm welcome to the forums!
    No expert on this, but I wonder since your using the secureserver, if SSL might not work better.
    Or maybe try...
    Incoming Mail Server Name (POP3): pop3.optonline.net
    Outgoing Mail server Name (SMTP): smtp.optonline.net
    or mail.optonline.com for both!?
    Nearly impossible to find any help on Cablevision's site.
    Also, I wonder if this might have something to do with Tiger's Mail also...
    http://discussions.apple.com/thread.jspa?threadID=1372763

  • Problem Sending mail Using Godaddy

    Hi all. I will be very thank to all. Please help me.!!!
    I have small problem while I send mail using Godaddy smtpout server. It is my code :
         Properties props = System.getProperties();
         props.setProperty("mail.transport.protocol", "smtp");
         props.setProperty("mail.host", "smtpout.secureserver.net");
         props.put("mail.smtp.auth", "true");
         props.setProperty("mail.user", "fengshuiMail");
         props.setProperty("mail.password", "here_my_password");
         Session mailSession = Session.getDefaultInstance(props, null);
         mailSession.setDebug(true);
         Transport transport = mailSession.getTransport("smtp");
         MimeMessage message = new MimeMessage(mailSession);
         message.setSentDate(new Date());
         message.setSubject("Feng Shui 5 Saved Reference ");
         message.setFrom(new InternetAddress("[email protected]"));
                   message.addRecipient(Message.RecipientType.TO, new InternetAddress("my_email_here"));
         MimeMultipart multipart = new MimeMultipart("related");
         // first part (the html)
         BodyPart messageBodyPart = new MimeBodyPart();
         messageBodyPart.setContent("TestMail", "text/plain");
         // add it
         multipart.addBodyPart(messageBodyPart);
         // put everything together
         message.setContent(multipart);
         transport.connect("smtpout.secureserver.net", "fengshuiMail",
                             "here_my_password");
         transport.sendMessage(message, message
                             .getRecipients(Message.RecipientType.TO));
         transport.close();I receive this exceptions :
    java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) java.security.AccessController.checkPermission(AccessController.java:427) java.lang.SecurityManager.checkPermission(SecurityManager.java:532) java.lang.SecurityManager.checkConnect(SecurityManager.java:1031) java.net.InetAddress.getAllByName0(InetAddress.java:1117) java.net.InetAddress.getAllByName0(InetAddress.java:1098) java.net.InetAddress.getAllByName(InetAddress.java:1061) java.net.InetAddress.getByName(InetAddress.java:958) java.net.InetSocketAddress.(InetSocketAddress.java:124) java.net.Socket.(Socket.java:178) com.sun.mail.util.SocketFetcher.getSocket0(SocketFetcher.java:130) com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:112) com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:959) com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:197) javax.mail.Service.connect(Service.java:233) javax.mail.Service.connect(Service.java:134) Email.doGet(Email.java:63) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239) java.security.AccessController.doPrivileged(Native Method) javax.security.auth.Subject.doAsPrivileged(Subject.java:517) org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:266) org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50) org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:140) java.security.AccessController.doPrivileged(Native Method) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:136) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:535) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:417) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300) org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374) org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743) org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866) org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) java.lang.Thread.run(Thread.java:595)
    But from my local machine it work good. From godaddy server it NOt send mail.

    Hey there,
    I am running into the same issue.
    I am not able to send emails from my email account with godaddy to gmail accounts.
    I tried your code with relay----- SMTP server, but it didn't work.
    Could you please give me the complete working code?
    It will be quite a help.
    Thanks.
    Ajeet

Maybe you are looking for

  • Finder doesn´t find documents in application support

    Hi there I saved eventually a few pages documents in the users/application support/iworks/templates/my templates folder. Now pages displays all these documents among the real templates. Of course I´d like to delete them. But Finder doesn´t display or

  • ITunes 10.2 not displaying devices

    Hi there iTunes is suddenly not showing my devices (iPad & iPhone) when I plug them in. I've done the restarts, checked for new versions, etc - but still nothing happens. Any ideas? Thanks

  • After 7.1.1 update jpg's unreadable and podcast app dies

    That about says it. the update screwed the phone and the ipad (at least the jpg issue, don't use it for podcasts).  Though more details..... iphone 4s jpgs unreadable/unimportable by lightroom, though aperture will import them. both recognize the fil

  • "Drawing Failed" After Camera RAW 4.0

    Hi, After testing the trial version of Photoshop CS3, I've found that processing images through camera raw leads to odd behavior when watching them in Windows Picture And Fax Viewer (particularly when zooming in), it just says "Drawing Failed" but th

  • I got the error "your work repository is not up to date"

    Hi guys, After a failed process of upgrade from 10g to 11g I got the error "your work repository is not up to date", this when I try to access to Designer Navegator. I attempt to access using the repositories cloned, and the original repositories I r