Search Results

Search found 2739 results on 110 pages for 'reader'.

Page 63/110 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • How do I detect server status in a port scanner java implementation

    - by akz
    I am writing a port scanner in Java and I want to be able to distinct the following 4 use cases: port is open port is open and server banner was read port is closed server is not live I have the following code: InetAddress address = InetAddress.getByName("google.com"); int[] ports = new int[]{21, 22, 23, 80, 443}; for (int i = 0; i < ports.length; i++) { int port = ports[i]; Socket socket = null; try { socket = new Socket(address, port); socket.setSoTimeout(500); System.out.println("port " + port + " open"); BufferedReader reader = new BufferedReader( new InputStreamReader(socket.getInputStream())); String line = reader.readLine(); if (line != null) { System.out.println(line); } socket.close(); } catch (SocketTimeoutException ex) { // port was open but nothing was read from input stream ex.printStackTrace(); } catch (ConnectException ex) { // port is closed ex.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (socket != null && !socket.isClosed()) { try { socket.close(); } catch (Exception e) { e.printStackTrace(); } } } } The problem is that I get a ConnectionException both when the port is closed and the server cannot be reached but with a different exception message: java.net.ConnectException: Connection timed out: connect when the connection was never established and java.net.ConnectException: Connection refused: connect when the port was closed so I cannot make the distinction between the two use cases without digging into the actual exception message. Same thing happens when I try a different approach for the socket creation. If I use: socket = new Socket(); socket.setSoTimeout(500); socket.connect(new InetSocketAddress(address, port), 1000); I have the same problem but with the SocketTimeoutException instead. I get a java.net.SocketTimeoutException: Read timed out if port was open but there was no banner to be read and java.net.SocketTimeoutException: connect timed out if server is not live or port is closed. Any ideas? Thanks in advance!

    Read the article

  • Scala: can't write setter without getter?

    - by IttayD
    This works: class ButtonCountObserver { private var cnt = 0 // private field def count = cnt // reader method def count_=(newCount: Int) = cnt = newCount // writer method // ... } val b = new ButtonCountObserver b.count = 0 But this doesn't class ButtonCountObserver { private var cnt = 0 // private field def count_=(newCount: Int) = cnt = newCount // writer method // ... } val b = new ButtonCountObserver b.count = 0 I get: error: value count is not a member of ButtonCountObserver Is it possible to create a setter (with the syntactic sugar) without a getter?

    Read the article

  • SharePoint List Service Recursive not working

    - by stranger001
    Hi, I am using the following code to retrieve the documents in a list. Its working fine. However, it only returns documents and folders in root of the doc library. Is there any thing wrong I am doing here? I am looking for files in sub folders with recursive mode. Service service = new Service(); service.setMaintainSession(true); call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL("<host>/_vti_bin/lists.asmx") ); call.setOperationName(new QName("http://schemas.microsoft.com/sharepoint/soap/","GetListItems")); call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean("true")); call.setProperty(Call.SOAPACTION_URI_PROPERTY,"http://schemas.microsoft.com/sharepoint/soap/GetListItems"); call.addParameter(new javax.xml.namespace.QName("http://schemas.microsoft.com/sharepoint/soap/", "listName"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, javax.xml.rpc.ParameterMode.IN); MessageElement me = new MessageElement(new QName("QueryOptions")); me.addChildElement(new MessageElement(new QName( "IncludeMandatoryColumns"))).addTextNode("true"); me.addChildElement(new MessageElement(new QName( "ViewAttributes"))).addAttribute(javax.xml.soap.SOAPFactory.newInstance().createName("Scope"), "Recursive"); MessageElement[] me1 = {me}; String strMyString = "" + "<Query>" + "<OrderBy><FieldRef Name=\"ows_Modified\" Ascending=\"TRUE\" /></OrderBy>" + "</Query>"; MessageElement[] meArray = { getMeFromString(strMyString) };// Array call.addParameter("query",org.apache.axis.Constants.XSD_SCHEMA, javax.xml.rpc.ParameterMode.IN); call.addParameter("queryOptions",org.apache.axis.Constants.XSD_SCHEMA, javax.xml.rpc.ParameterMode.IN); call.setReturnType(org.apache.axis.Constants.XSD_SCHEMA); Schema ret = (Schema)call.invoke(new Object[] {"listGUID",meArray, me1 }); public org.apache.axis.message.MessageElement getMeFromString(final String strMyString) { DocumentBuilder docBuilder = null; try { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (final ParserConfigurationException e) { e.printStackTrace(); } catch (final FactoryConfigurationError e) { e.printStackTrace(); } final StringReader reader = new StringReader(strMyString); final InputSource inputsource = new InputSource(reader); Document doc = null; try { doc = docBuilder.parse(inputsource); } catch (final SAXException e) { e.printStackTrace(); } catch (final IOException e) { e.printStackTrace(); } final Element ele = doc.getDocumentElement(); final MessageElement msg = new MessageElement(ele); return msg; }

    Read the article

  • How to set HTML list as mx:DataGrid data provider?

    - by Ole Jak
    So I have Html like this http://trac.edgewall.org/wiki/RecentChanges (I want to create some Flash Track reader which will be opensource) I need to list in my DataGrid Index of all viki pages in form like +-----------+--------+ |page name |page url| +-----------+--------+ | name | url | +-----------+--------+

    Read the article

  • Handling extra newlines in csv files parsed with Python?

    - by rmihalyi
    I have a CSV file that contains extra newlines in some fields, e.g.: A, B, C, D, E, F 123, 456, tree , very, bla, indigo I tried the following: import csv catalog = csv.reader(open('test.csv', 'rU'), delimiter=",", dialect=csv.excel_tab) for row in catalog: print "Length: ", len(row), row and the result I got was this: Length: 6 ['A', ' B', ' C', ' D', ' E', ' F'] Length: 3 ['123', ' 456', ' tree'] Length: 4 [' ', ' very', ' bla', ' indigo'] Does anyone have any idea how I can quickly remove extraneous newlines? Thanks!

    Read the article

  • How to display content of one site in another using PHP?

    - by Joyan
    Hello I'm trying to show contents of two websites in one another , someone suggest me to use RSS reader but my question is : is there anything else i could try to show the contents , beside using rss !? i thought i can connect to the database of another website , but that didnt work / thanks in advance

    Read the article

  • How to read expected child nodes of a given node from schema in PHP?

    - by MartyIX
    I was wondering if there's an implementation of a XML schema reader that for an arbitrary node in XML schema provides list of nodes which are supposed to be present as child nodes of given node, restrictions on nodes and so on. I'm planning to program it for my purposes but I would like to know if it isn't solved somewhere. I really need only a small subset what I described above. Thanks for tips!

    Read the article

  • Clarification needed about Python CSV file format parsing

    - by HH
    Format is like: CHINA;2002-06-25 00:00:00.000;5,60 CHINA;2002-06-26 00:00:00.000;5,32 CHINA;2002-06-27 00:00:00.000;5,31 and I try to use Python's CSV tools to parse it but cannot understand the paragraph, source: And while the module doesn’t directly support parsing strings, it can easily be done: import csv for row in csv.reader(['one,two,three']): print row Could someone clarify the line ['one,two,three']? How would you use it with format A;B;C?

    Read the article

  • XMLReader : how to catch syntax errors in the xml file ?

    - by mishal153
    Hi, I have an XML file with syntax errors. eg. <Viewport thisisbad Left="0" Top="0" Width="1280" Height="720" > When i create an XML reader it does not throw any errors. I there a way to do syntax checking automatically, like XMLDocument does ? I have tried setting various XmlReaderSettings flags but found nothing useful.

    Read the article

  • Android phone as a dedicated device

    - by user649459
    Hi, We want to use Android mobile for dedicated application. Can somebody suggest how can we make it happen. Here are the requirement: The phone when started, should launch our application., so the user cannot launch any other application. The application will be a 1D barcode reader. The application should be live as long as the phone is up and running, user cannot close the application at all. Thanks for your help. Regards, Manish

    Read the article

  • PHP object exchange between servers

    - by bensiu
    I got script what read from database and manipulate it so on the end I got $result array... on one server is it possible to serialize this object and pass it to other script so this $result array could be available for other script on second server... I got on first server: return serialize ( $results ); and on second: $data = unserialize ( file_get_contents ( 'http://www.......com/reader.php' ) ); ...but there is no communication between .... What I am doing wrong ? Bensiu

    Read the article

  • How do I mount a remote Linux folder in Windows through SSH?

    - by Jared
    I'm a blind student currently in a system admin/shell programming class. Although ssh works fine for executing commands like ls, pwd, etc editors do not work well with my screen reader and an ssh session. I was wondering if it is possible to mount a Linux folder over ssh so it appears as a windows drive? This way I could edit any files I needed to with accessible software and not have to constantly use SCP to send files back and fourth.

    Read the article

  • C#:checking existing record in database Mysql

    - by Meko
    HI.I searched this question inform and I found solution to change column property Unique Index.Now If I try to insert same record cmd.ExecuteNonQuery() gives error that record exist ,but how can use this exception to give user a message that record exist and must enter new one ? I am trying to make some thing like if(cmd.ExecuteNonQuery() !=true ) { MessageBox.Show("User Exists"); } But I dont know what returns cmd.ExecuteNonQuery() ? Or I must get records using reader in table and compare them with text in Textfiel?

    Read the article

  • Ignore first line on csv parse Rails

    - by Jack
    Hi, I am using the code from this tutorial to parse a CSV file and add the contents to a database table. How would I ignore the first line of the CSV file? The controller code is below: def csv_import @parsed_file=CSV::Reader.parse(params[:dump][:file]) n = 0 @parsed_file.each do |row| s = Student.new s.name = row[0] s.cid = row[1] s.year_id = find_year_id_from_year_title(row[2]) if s.save n = n+1 GC.start if n%50==0 end flash.now[:message] = "CSV Import Successful, #{n} new students added to the database." end redirect_to(students_url) end

    Read the article

  • android: how do i open another app from my app?

    - by mtmurdock
    I understand how to use intents and startActivity() when opening another activity within my own app, but how do you start a different app? specifically: -how do you determine if the user has the needed app installed on their device? -how do you start that app? -how do you pass parameters to that app? -how do you find all this info out for a specific app (say Adobe reader, or google maps)?

    Read the article

  • How to get data from http protected URL

    - by Ole Jak
    so I have a Track system with some kind of protection. So to get some data from any URL you have to pass protection like this http://188.134.14.27/projects/cloudobserver/login and then (in browser) you can see some pages http://188.134.14.27/projects/cloudobserver/wiki/CloudObserverCMSSetup (if you havent passed login youll get no content) so how to login and get data from page using flash/actionscript (btw I am triing to create an rss reader)?

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >