E/a-exception Software Caused Connection Abort Socket Write Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site
Software Caused Connection Abort Socket Write Error Java
About Us Learn more about Stack Overflow the company Business Learn more about software caused connection abort socket write error testng hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Software Caused Connection Abort Socket Write Error Minecraft
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up java.net.SocketException: Software caused connection software caused connection abort socket write error tomcat abort: socket write error [duplicate] up vote 11 down vote favorite 1 This question already has an answer here: Official reasons for “Software caused connection abort: socket write error” 9 answers I am trying to send an image from a Java desktop application to a J2ME application. The problem is that I am getting this exception: java.net.SocketException: Software caused connection abort: socket write error I java.net.socketexception software caused connection abort socket write error weblogic have looked around on the net, and although this problem is not that rare, I was unable to find a concrete solution. I am transforming the image into a byte array before transferring it. These are the methods found on the desktop application and on the J2ME respectively public void send(String ID, byte[] serverMessage) throws Exception { //Get the IP and Port of the person to which the message is to be sent. String[] connectionDetails = this.userDetails.get(ID).split(","); Socket sock = new Socket(InetAddress.getByName(connectionDetails[0]), Integer.parseInt(connectionDetails[1])); OutputStream os = sock.getOutputStream(); for (int i = 0; i < serverMessage.length; i++) { os.write((int) serverMessage[i]); } os.flush(); os.close(); sock.close(); } private void read(final StreamConnection slaveSock) { Runnable runnable = new Runnable() { public void run() { try { DataInputStream dataInputStream = slaveSock.openDataInputStream(); int inputChar; StringBuffer results = new StringBuffer(); while ( (inputChar = dataInputStream.read()) != -1) { results.append((char) inputChar); } dataInputStream.close(); slaveSock.close(); parseMessage(results.toString()); results = null; } catch(Exception e) { e.printStackTrace(); Alert alertMsg = new Alert("Error", "An error has occured while reading a message from the server:\n" + e.getMessage(), null, AlertType.ERROR); alertMsg.setTimeout(Alert.FOREVER); myDisplay.setCurrent(alertMsg, resultScreen); } } }; new Thread(runnable).start(); } I am sending the message across a LAN, and I
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Clientabortexception Java Net Socketexception Software Caused Connection Abort Socket Write Error
Us Learn more about Stack Overflow the company Business Learn more about hiring java.net.socketexception software caused connection abort socket write error testng developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
Software Caused Connection Abort Socket Write Error Eclipse
Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Software caused connection abort: socket write http://stackoverflow.com/questions/2861533/java-net-socketexception-software-caused-connection-abort-socket-write-error error up vote 1 down vote favorite I have a case where the client after establishing a connection with the server, receives one file and when the same connection was used ( persistent ) I end up getting this error mentioned above. Below is the implemented code: Scanner in = new Scanner(file); this.clientSocket = new Socket(this.host,this.port); this.os = new DataOutputStream(this.clientSocket.getOutputStream()); this.is = this.clientSocket.getInputStream(); while(in.hasNextLine()){ newFile = http://stackoverflow.com/questions/10160940/software-caused-connection-abort-socket-write-error in.nextLine(); System.out.println(newFile); this.os.writeBytes(newFile + '\n'); this.os.flush(); scanFileList(); writeFile(); } and the server side implementation is: final class HttpRequest implements Runnable { final static String CRLF = "\r\n"; Socket socket; static String dir; BufferedOutputStream outToClient = null; // Constructor public HttpRequest(Socket socket) throws Exception { this.socket = socket; dir = "C:\\Users\\"; } // Implement the run() method of the Runnable interface. public void run() { try { // Get a reference to the socket's input and output streams. InputStream is = socket.getInputStream(); outToClient = new BufferedOutputStream(socket.getOutputStream()); processRequest(is,outToClient); } catch (Exception e) { System.out.println(e); } } private void processRequest(InputStream is,BufferedOutputStream os) throws Exception { // Set up input stream filters. BufferedReader br = new BufferedReader(new InputStreamReader(is)); // Get the request line of the HTTP request message. String fileName = br.readLine(); // Prepend a "." so that file request is within the current directory. System.out.println(fileName); // Open the requested file. File myFile = null ; boolean fileExists = true ; myFile = new File(dir + fileName); FileInputStream fis = null ; try { fis = new FileInputStream(dir + fileName); System.out.println(fis); } catch (FileNotFoundException e) { fileExists = false ; } // Debug info for private use System.out.println("Incoming!!!"); // S
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... C# questions Linux questions ASP.NET questions SQL questions VB.NET questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ java.net.SocketException: Software caused connection abort: socket write error Exception after writing some values Rate this: Please Sign up or sign in to vote. See more: Java serialport Communication I have a program which is written by the man who is not here. Now the problem is that the program throws the exception after writing some lines. The code is as follows: Class: InclinometerCommunicator.java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.SocketException; import javax.comm.SerialPort; import javax.comm.UnsupportedCommOperationException; import org.dellroad.jvser.TelnetSerialPort; import org.apache.commons.net.telnet.TelnetClient; public class InclinometerCommunicator { private static final int DEFAULT_TCP_PORT = 10001; private static final byte ADDRESS = (byte) 0xB1; private static final byte ENQUIRY = 5; private static final int PACKET_LENGTH = 11; private TelnetSerialPort port; public static final int BAUD_RATE = 9600; public static final int DATA_BITS = SerialPort.DATABITS_8; public static final int PARITY_BITS = SerialPort.PARITY_NONE; public static final int STOP_BITS = SerialPort.STOP