Networking :: Error While Sending Files Between Two Systems Using Socket

Mar 11, 2014

I've been trying to send a file(text & image files) from one system to another. somewhat I did, but file is not send originally in destination system. It shows AccessDeniedException on the destination system. What should do to avoid this exception.

View Replies


ADVERTISEMENT

Networking :: Intermittent Socket Closed Exception

Jun 24, 2014

We have a servlet application running under jboss 7.1.1/java 1.7 that sends http requests to another server. Everything works fine for most of the time, but occasionally (from one to a couple of times a day) we get a “Socket closed” exception.  I’ve been trying to find out what might be causing this but so far I’ve been unsuccessful. By the way, this has been happening while the application was running under older versions of Jboss/Java so the version might not be that relevant.

Here’s an excerpt from the method where this happens:
. . . . .
try
{
HttpURLConnection conn = (HttpURLConnection) urlEndpoint.openConnection();
   conn.setRequestMethod("POST");
   conn.setDoInput(true);
   conn.setDoOutput(true);

[Code] ....

And here’s what the exception looks like:
. . . . . .
java.net.SocketException: socket closed               
at java.net.SocketInputStream.socketRead0(Native Method)
                at java.net.SocketInputStream.read(SocketInputStream.java:150)
                at java.net.SocketInputStream.read(SocketInputStream.java:121)
                at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

[Code] ....           
 
In my investigation I  came across some posts that were mentioning the sockets pool the http connection is keeping, but I’m not sure whether and how this solve the problem I have.

View Replies View Related

Networking :: Socket Creation Too Slow Versus URLConnection

Oct 27, 2014

I'm trying to write a transparent proxy like polipo. Polipo is written in C and I want to have the same result in java.
 
A simple program that can filter/monitor all connections created and closed by the browser.
 
To do so, I've chosen to work with sockets, because that's the only way i know to read and write raw data to and from the browser in a completely transparent way.
 
In this moment my code reads and writes every couple of request/response but I've noticed profiling it that the time needed to create the socket is a bottleneck.

Using URLConnection to create the same connection I need much less time than sockets.
 
When socket creation implies 50ms URLConnection implies only 1ms.

View Replies View Related

Networking :: URL Connection Error On HTTPs

Feb 16, 2013

I have noticed an error, that makes sometimes troubles, when downloading jars from https addresses, when there are many jars to download..

Best example is by opening Javas on Java version checker. [URL] ....

I get also following log...

network: Connecting https://www.java.com/jsp_utils/jreverification.jar with proxy=DIRECT
network: Connecting http://www.java.com:443/ with proxy=DIRECT
network: Connecting https://www.java.com/jsp_utils/jreverification.jar with cookie "JSESSIONID=22ABBA2BE9B5789629C276AC35BDF969; s_cc=true;

Even if the address is https, java try to access via http protocol on port 443, and that leads sometimes to problems..

I have noticed this, when I have used URLConnection(HttpURLConnection) for my self, as soon Java sends http link on https address, the jar gets sometimes not loaded, and i get error about missing class that get called..

On http addres it is not so bad, since same protocol is used, but evidently, that is evil for https..

As you see, that happens already when loading Jar by Applet Starter and at all, it happens each time on any URLConnection

###############################
Java Plug-in 10.13.2.20
Using JRE version 1.7.0_13-b20 Java HotSpot(TM) Client VM
User home directory = X:Usersadmin
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect

[Code] .....

View Replies View Related

FTP Program With Server Is Not Sending Existing Files On Client

Feb 8, 2014

I'm creating ftp program which server will send not existing files on client to him.

There is method responsible for creating connection and sending list of files on client written by me.

Java Code:

[JAVA]//client method
public void enableClient() throws IOException, ClassNotFoundException {
System.out.print("Rozpoczęto działanie klienta");
strIP = jtfIP.getText();
intPort = Integer.parseInt(jtfNrPortu.getText());
clientPath= "C:/serweris/";
sck = new Socket(strIP, intPort);

[Code]....

View Replies View Related

Sending To All Vs Sending To One Person In Server / Client Program

Apr 17, 2014

I have two programs that I'll post below, one is a Server and the other is a Client. The ChatServer runs once and many clients can run ChatClient from separate computers and talk together in their GUI's. The the client program comes with two buttons, one that's simulates the sending of a message to a single user ; "Send Message To User", and one that just generally sends a message ; "Send Message To All". Although now the Clients on the server seem to be able to selectively send messages to an individual by giving the recipient name, all the clients can see that message, which is not exact what I am aiming for. What I am going for is having the "Send Message To User" button click to send a message to the named user without all other users seeing the message.

The Server Program Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;

[Code] ....

Now I have tried thing like having various input output streams and trying to connect those, but no luck. Tried fiddling with having the names arraylist directing the messages to one client versus all but that did not work out either. How I what I would need to do to go about doing this?

View Replies View Related

Java Applications Communication On Different Systems

Nov 1, 2014

I'm new to java and haven't develop any application before that... I need to develop an application through which i can send data from 1 computer to another computer. These communication in between the computers are those are under one router connection. Means they can connect even without internet access

Main concept is as follow

1. Java application on computer A [server side application]
2. Java application on Computer B [Client side application]
3. Java application on computer C [Client side application]

Now computer B and C communicate with computer A. but they don't know about presence of each other

View Replies View Related

JRE :: Date Shifting 1 Day Back On 1 Of Many Systems

Feb 24, 2014

This piece of java software I am responsible for is running throughout numerous locations in my country, there is only 1 location which has trouble with the dates being displayed incorrectly, birthdates of clients are displayed as a day earlier. It seems pretty safe to say it is a problem on their end... But still, they're asking me for an explanation as to why java would treat a date differently in this rare case.

The date (a birthdate) comes from an oracle database, it is a date without a time (trunced date). It enters the application as a member of the client-class, it is NOT being set or changed after that. It goes through several layers in the application, then ends up in a GUI class which unwraps it from the "client"-object and puts a SimpleDateFormat (new SimpleDateFormat("dd-MM-yyyy")) on it. My first and only hunch was the timezone settings, but that seems to be OK!

View Replies View Related

Managing Class Paths On Different Operating Systems

Jun 5, 2014

I use git as my SCM and I use both Ubuntu and Mac OSX. The home directory of the two operating systems are different and there lies the problem. When I commit the .classpath to version control, it looks something like this:

Java Code:

<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/java-json.jar"/>
<classpathentry kind="lib" path="/Users/MyUser/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath> mh_sh_highlight_all('java');

Now when I update my project on Ubuntu. I have to change the build path again because it is referencing paths on OSX. And this goes back and forth. Rather than remove this file from git with .gitignore, I'd prefer to use a global environment variable like as follows:

Java Code:

<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/java-json.jar"/>
<classpathentry kind="lib" path="$HOME/Documents/github/Gateway/GDGateway/postgresql-9.3-1101.jdbc41.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath> mh_sh_highlight_all('java');

Is this possible?

View Replies View Related

Error When Trying To Write Files?

Feb 16, 2015

I'm trying to write information into a file using PrintWriter. The program complies correctly but when it get's to the following part of the program, an error is given. "Exception in thread 'main' java.io.FileNotFoundException" What is wrong with it?

System.out.print("Enter the filename:");
filename = kb.nextLine();
PrintWriter outputFile = new PrintWriter(filename);
outputFile.println(balance);
outputFile.print(item1+" "+item1Price);
outputFile.println(" "+item1Quantity);
outputFile.print(item2+" "+item2Price);
outputFile.println(" "+item2Quantity);
outputFile.print(item3+" "+item3Price);
outputFile.println(" "+item3Quantity);
outputFile.close();
System.out.println("Data written to the file.");

View Replies View Related

JList Manipulation - How Operating Systems Manage Processes

Sep 29, 2014

I am attempting to use JLists to complete a program that models how operating systems manage processes. A quick synopsis of what it is supposed to do. Each process is to have a priority level (I chose to do 1 -3 with 3 being the most important) and there are supposed to be three lists. One for ready processes, blocked processes, and a running process.

My issues:

1) when I block a process it does indeed switch lists but when it is copied into the blocked list it pulls the element number instead of what the actual process number is. For ex: Say the ready list has 5 processes / I delete 2 / Leaving process 1, 2, 5. When I block 5, it gets registered in the blocked list as process 2.

2) I can't figure out how to give a label to each of my scroll panels (JLists) to signify which box is ready / blocked / and running

3) My switch button - I have commented in what I need to do but don't know how I am going to do it.

Below are my files:

Main

import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Queue;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class PQueue {
public static void main(String[] args) throws InterruptedException {

[Code] ....

View Replies View Related

3 Different Files Using Encapsulation (Data Hiding) - Object Creation Error

Mar 21, 2015

I have my code in 3 different files using encapsulation (Data hiding) and i have 1 problem at the very end of my code in my if and else statement (very bottom) when trying to call the classes from the other 2 documents. I will put the code in 1st document to 3rd document.

// FIRST DOCUMENT
public class CollegeCourse { //class name
//variables
String deptName;
int courseNum;
int credits = 3;
double fee;

[Code] ....

UPDATE: error message is

UseCourse.java:24: error: cannot find symbol
LabCourse lc = new LabCourse(department, course, Credits);
^
symbol: variable department
location: class UseCourse
UseCourse.java:24: error: cannot find symbol
LabCourse lc = new LabCourse(department, course, Credits);

[Code] ....

4 errors

View Replies View Related

Reading Multiple Text Files From A Folder - Cannot Resolve Syntax Error

Apr 29, 2015

In the current program I am trying to read multiple text files from a folder. I keep getting the following syntax error

"Syntax error on token ";", { expected after this token".

I highlighted the line where im getting this error in red.
 
import java.io.*;
import java.util.*;
 public class CacheData {
  // Directory path here
    String path = "C:myfiles*.txt";
 
[Code] ....

View Replies View Related

Process 10000 XML Files / Verify And Insert Data Into Database - Java Heap Memory Error

Oct 12, 2013

I need to process 10000 xml files and verify and insert the data into database. I am loading all the files in the file object and iterating one by one. I am getting the memory issue. How to handle this?

View Replies View Related

Networking Flow Of Control

Sep 2, 2014

So I'm working on some networking code and I have the Server running as its own thread, then I have a PacketListener which is contained in the Server, that is running on its own thread too. As of right now, the PacketListener waits for packets via DatagramSocket.receive() and then adds them to a queue. The Server runs in a loop and it checks that queue for packets and then polls the most recent and process it before sleeping for 1 millisecond. Here is my question though, I'm considering changing the program to a more observer pattern structure in that when the PacketListener would receive a packet, rather than add it to the queue, it'd notify the server which would process it. However, wouldn't this cause additional time required within the PacketListener thread dedicated to processing the packets rather than listening for them?

View Replies View Related

Networking :: No Websocket Support For Swing

Jun 18, 2015

When a JavaScript client attempts to open a socket, instead of the connection opening it immediately closes. The client is using:
 
webSocket = new WebSocket("ws://localhost/example");
 
The same thing happens for com.sun.net.httpserver.HttpsServer where client is using:
 
webSocket = new WebSocket("wss://localhost/example");
 
How can I enable websocket support?
 
If it's not possible, how can I request for it to be added as a new feature?

View Replies View Related

Networking :: Get Timestamp Of A File On Server

Aug 6, 2014

I have a requirement to get the details of the files present in a directory on a server. I need to get the file names and timestamp. I have the below code to get the file names:

Connection conn = new OracleDriver().defaultConnection();
ArrayDescriptor arraydesc =
ArrayDescriptor.createDescriptor ("DIRLIST_T", conn);
File myDir = new File (dir);
String[] filesList = myDir.list();
ARRAY dirArray = new ARRAY(arraydesc, conn, filesList);
return dirArray;
 
But am not able to get the timestamp. How can I get the timestamp as well.

View Replies View Related

Networking :: Limiting Bandwidth Usage?

Mar 18, 2015

I would like to limit my bandwidth usage when accessing/downloading files (similar to the --limit-rate 50K option for curl and wget) as the website has limited bandwidth. I am not exactly sure how to implement this, but I'm guessing it be accomplished via the BufferedReader? I have attached the current code below.
 
import java.io.OutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;

[Code]....

View Replies View Related

Networking :: SocketChannel Hangs Up After Several Read (ByteBuffer)

Nov 9, 2013

I wrote a proxy in java. The version with ServerSocket-Socket/Stream-IO works wonderfully. When I rewrote it to ServerSocketChannel-SocketChannel/ByteBuffer it works also very well. However, when I access YouTube things happen weirdly: The video is frozen after 3 or 5 minutes (but this did not with the version of ServerSocket/Socket). I strongly assume that there probably was a nasty bug....  The (shortened) codes are:

Server:
        public class BeanServer extends Thread {
             public BeanServer( ) { }
          public void run( ) {
               try {
                    bServer = ServerSocketChannel.open();

[Code] .....

View Replies View Related

Networking :: Ethernet Works Fine But Not Wireless

Jan 30, 2014

My application with Oracle Database only works with Ethernet, I tried to connect via wireless without any response. When I run the command netstat the port state is WAIT TIME and then be closing. The clients machines run Windows 7 and 8 and the server run Suse Linux Enterprise Server 10 SP2, if the client machine run XP all works fine. I disabled the firewalls in the both sides.

View Replies View Related

Networking :: Create A New Text File In FTP Server

Jun 26, 2015

I am trying to create a new text file in FTP Server using FTPClient but im not able to do. By using storeFile method i can only upload file that is already exists in my local system. But my requirement is to create file directly into FTP Server.

View Replies View Related

Networking :: Intercept All Outgoing HTTP Calls

Dec 12, 2014

Similar to HttpFilter  (javax.Servlet.Filter ) which when added in web.xml can intercept any incoming request to JVM / outgoing (as response) independent of framework ( Spring/CXF/Jersy etc ) without any code changes (excluding the filter itself), I am trying to find an API or approach which could intercept any outgoing HTTP calls from JVM to add/modify headers independent of framework.
 
Quite often the word Outgoing HTTP call is misinterpreted in the forums so let me explain with example.
 
Let us assume there are two JVMs, jvm1 and jvm2. and there are HTTP calls being made from JVM1 to JVM2. I would like to intercept the HTTP connection being made from JVM1 to modify the headers information before the call happens. I do not want the code to be tied to a specific framework so that I can as bundle the interceptor as a jar and share it with application team. Changes in web.xml is fine.

View Replies View Related

Networking :: Connect FTPClient To IBM 4690 OS Server

Apr 17, 2008

I'm facing some problem connecting to a IBM 4690 OS Server with the FTPClient class from the commons-net-1.4.1 library. It seems it can't read the folder on the server. The problem is that using the FTP client from Internet Explorer is works perfectly.

Here is my code (kind of hardcoded but it's only to test).

         FTPFile[] files = null;
          try {
               files = listFiles(remoteFolder);
          } catch (ParserInitializationException e) {

[Code] ...

Here is the ParserInitializationException that it throws:

org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: OS 4690 operating system
     at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:118)
     at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:2358)
     at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2141)
...

I've tried to use many of the FTPFileListParser available but without success. How could I handle the problem? Where could I find a Parser that would works?

View Replies View Related

Networking :: Getting Exception While Trying To Remotely Call One Servlet - URL Connect

Oct 14, 2014

I am trying to remotely call one servlet and getting below exception:
 
java.io.StreamCorruptedException: invalid stream header: 3C21444F
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:785)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:282)
at com.deere.isg.dm.web.controller.StatsController.getOtherAdminStatsBeanFromConnectURL2(StatsController.java:224)
at com.deere.isg.dm.web.controller.StatsController.main(StatsController.java:122)
 
As per my program i am just simply calling this:
 
URL url = new URL(controllerPath + STATS_PATH);
 
  httpURLConnection = (HttpURLConnection)url.openConnection();
  httpURLConnection.setRequestMethod("GET");
  httpURLConnection.connect();
 
  inputStream = httpURLConnection.getInputStream();
  objectInputStream = new ObjectInputStream(inputStream);

View Replies View Related

Networking :: Unable To Connect Remote Machine - Network Path Was Not Found

Jan 30, 2014

I am trying to connect a remote machine but I can't. There is a shared folder in the remote machine, when I write the path to file browser in local machine, it does not find the path specified. Both machines have successful network condition and ping each other. Also, the shared folder is opened to everyone, there should not be a permission problem, right?

View Replies View Related

How To Create Java Files Into Windows Applications (Exe Files)

Oct 26, 2014

What step to know to develop software..

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved