Search Results

Search found 10798 results on 432 pages for 'port scanning'.

Page 12/432 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • forward same port but for two different IPs (cisco)

    - by Colin
    Hi! I have a cisco running IOS 12.0(25) responding to two different IPs addresses: IP_A and IP_B. Behind this router I also have two different servers: server_A and server_B. What I want is to forward port 22 to both servers, so: IP_A, port22 -> server_A, port22 IP_B, port22 -> server_B, port22 ATM this only works for one of them (server_A), this is my config: interface Ethernet0/0 description Internet ip address IP_A 255.255.255.0 ip address IP_B 255.255.255.0 secondary no ip directed-broadcast ip nat outside no ip mroute-cache no cdp enable ip nat pool pool_A IP_A IP_A netmask 255.255.255.0 ip nat pool pool_B IP_B IP_B netmask 255.255.255.0 ip nat inside source list A pool pool_A overload ip nat inside source list B pool pool_B overload ip nat inside source static tcp server_B 22 IP_B 22 extendable ip nat inside source static tcp server_A 22 IP_A 22 extendable access-list A permit server_A access-list B permit server_B

    Read the article

  • apache port number

    - by user983223
    For each development sites I want to have a unique port number. For instance, domain.com:1234 This is what I have in my httpd.conf file. After restart the page domain.com:1234 is not showing in the browser. Is there anything else that I need to do besides what I have already done to make this work? Listen *:1234 <VirtualHost *:1234> DocumentRoot /var/www/dev_sites/test ServerName domain.com:1234 </VirtualHost> It looks like if I go to my local hostname (kk.local:1234) it shows. Is there some sort of dns that I need to do? I really don't want to go into godaddy everytime I add a development site. Is there a way around that?

    Read the article

  • How can I open a port in OS X 10.6?

    - by Ian
    Mine is MacBook Air, so I cannot plug to the modem directly. And I do want to turn my firewall off. How can I specify to open a port, like port 56789 in Mac OS 10.6.8? I know in old Mac OS, there is a option for me to specify a custom port. But I cannot find it in OS X 10.6.8. In System Preferences / Security / Firewall, I only can allow an APPLICATION to access a new port. However, now I'm programming, using a new port. So, it seems not suitable for me. So, can I simply open a port instead of using an Application to open a port?

    Read the article

  • Port forwarding using IP Tables

    - by Darider
    I have a server with a LAN facing address of 192.168.5.100 (eth0) and another LAN facing address of 192.168.6.6 (eth1). On this server I have a Virtualbox instance of fedora running an apache webserver (on port 8080) with a bridged interface to eth1 on the host server with address of 192.168.6.7 Users on the 192.168.6.x network can access the Webserver on the Vbox instance (192.168.6.7) with no problems. My question is what kind of iptables entries or commands should be made/executed so as to allow for users on the 192.168.5.x network to access the webserver on the vbox instance. (I'm hoping their url can be something like: http://192.168.5.100:8080)

    Read the article

  • Configure Postfix to send/relay emails Gmail (smtp.gmail.com) via port 587

    - by tom smith
    Hi. Using Centos 5.4, with Postfix. I can do a mail [email protected] subject: blah test . Cc: and the msg gets sent to gmail, but it resides in the spam folder, which is to be expected. My goal is to be able to generate email msgs, and to have them appear in the regular Inbox! As I understand Postfix/Gmail, it's possible to configure Postfix to send/relay mail via the authenticated/valid user using port 587, which would no longer have the mail be seen as spam. I've tried a number of parameters based on different sites/articles from the 'net, with no luck. Some of the articles, actually seem to conflict with other articles! I've also looked over the stacflow postings on this, but i'm still missing something... Also talked to a few people on IRC (Centos/Postfix) and still have questions.. So, i'm turning to Serverfault, once again! If there's someone who's managed to accomplish this, would you mind posting your main.cf, sasl-passwd, and any other conf files that you use to get this working! If I can review your config files, I can hopefully see where I've screwed up, and figure out how to correct the issue. Thanks for reading this, and any help/pointers you provide! ps, If there is a stackflow posting that speaks to this that I may have missed, feel free to point it out to me! -tom

    Read the article

  • Port forwarding on D-Link DIR-615 super-slow, useless

    - by Jaroslav Záruba
    Hello I have replaced my old router with DIR-615 from D-Link, and now the port forwarding is so slow it makes the router practically useless for requests coming from outside of my network. Accessing the router itself (admin UI) from outside is without any issues, no delay whatsoever. But when I try to access a service residing on any of the computers in my network from outside the requests take minutes and minutes. (E.g. I can see source of my GWT-app main page, but loading additional CSS and JS files takes years.) If anyone could recommend any further diagnostics I should do to figure out what is happening it would be great. Few notes: happens with more services (web-app on Tomcat, viewing directory index via Apache) it does not make a difference whether the service is hosted on wired or wireless PC accessing the service on a localhost works fine, as does any 'inner' communication turning off firewall on target PC does not make difference either (makes sense) when I replace this router with the old one (both 192.168.1.1) everything works fine I see nothing suspicious in the router's log I believe I have the latest firmware (4.11) DIR-615 sucks, it already died once completely Regards Jarda Z.

    Read the article

  • TCP: Address already in use exception - possible causes for client port? NO PORT EXHAUSTION

    - by TomTom
    Hello, stupid problem. I get those from a client connecting to a server. Sadly, the setup is complicated making debugging complex - and we run out of options. The environment: *Client/Server system, both running on the same machine. The client is actually a service doing some database manipulation at specific times. * The cnonection comes from C# going through OleDb to an EasySoft JDBC driver to a custom written JDBC server that then hosts logic in C++. Yeah, compelx - but the third party supplier decided to expose the extension mechanisms for their server through a JDBC interface. Not a lot can be done here ;) The Symptom: At (ir)regular intervals we get a "Address already in use: connect" told from the JDBC driver. They seem to come from one particular service we run. Now, I did read all the stuff about port exhaustion. This is why we have a little tool running now that counts ports and their states every minute. Last time this happened, we had an astonishing 370 ports in use, with the count rising to about 900 AFTER the error. We aleady patched the registry (it is a windows machine) to allow more than the 5000 client ports standard, but even then, we are far far from that limit to start with. Which is why I am asking here. Ayneone an ide what ELSE could cause this? It is a Windows 2003 Server machine, 64 bit. The only other thing I can see that may cause it (but this functionality is supposedly disabled) is Symantec Endpoint Protection that is installed on the server - and being capable of actinc as a firewall, it could possibly intercept network traffic. I dont want to open a can of worms by pointing to Symantec prematurely (if pointing to Symantec can ever be seen as such). So, anyone an idea what else may be the cause? Thanks

    Read the article

  • Thin server : `start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError)

    - by Rubytastic
    My thin webserver fails to start with an error message. I can hardly find any information or leads on how to fix this, anyone an idea? thx Thin web server (v1.5.0 codename Knife) Maximum connections set to 1024 Listening on 0.0.0.0:9292, CTRL+C to stop /srv/gamers/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:526:in start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError) from /srv/gamers/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:526:instart_server' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/backends/tcp_server.rb:16:in connect' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/backends/base.rb:55:inblock in start' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in call' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:inrun_machine' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in run' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/backends/base.rb:63:instart' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin/server.rb:159:in start' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:inrun' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in start' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:instart' from /srv/gamers/shared/bundle/ruby/1.9.1/gems/rack-1.4.1/bin/rackup:4:in <top (required)>' from /srv/gamers/shared/bundle/ruby/1.9.1/bin/rackup:19:inload' from /srv/gamers/shared/bundle/ruby/1.9.1/bin/rackup:19:in `'

    Read the article

  • My Ruby on Rails application only works if the address contains the port

    - by True Soft
    I have a Ruby on Rails application that works ok on my notebook ( http://localhost:3000/ ) I uploaded it on my hosting server, created with CPanel X an application, the URL is http://example.com:12007/ created a rewrite from http://example.com/ to http://example.com:12007/, and started it. If I write in my browser http://example.com:12007/ or http://www.example.com:12007/ all the pages work as expected. But if I write http://example.com/ or http://www.example.com/ the first page is displayed, but without any css or images (just like it wouldn't find them). I can see all the text (even the text from my MySQL database), but with no format. And if I click on any link, I get a error page like this: Not Found The requested URL /some_controller was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. What should I do to make my website work without writing the port in the address bar? The content of my /public_html/.htaccess file is RewriteEngine on RewriteCond %{HTTP_HOST} ^example.com$ [OR] RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteRule ^/?$ "http\:\/\/127\.0\.0\.1\:12007%{REQUEST_URI}" [P,QSA,L] which I guess was generated by CPanel Rewrites.

    Read the article

  • Several web applications on a single port

    - by Nevermind
    We're developing an online browser-based game. The game itself is a plugin in the web page, that uses TCP connection to a game server, and also sends http requests to "content server" web application. This makes 3 servers total: the site itself, game server and content server. Site and content server are IIS web applications, game server is a custom application communicating over TCP with proprietary protocol. While the game is in beta stage, all these servers are physically hosted on a single machine, and distinguished by ports. For example, website is game.example.com:80, game server is game.example.com:34285 and content server is game.example.com:50000. This works OK most of the time, but some of our players have ports other than 80 closed. Is there any way to make all these application work through port 80, while still having them one one physical server? Maybe using different sub-domains? There's probably a way to make IIS forward requests to different web applications based on URL alone, but that doesn't help with game server. Edit Server is Windows Server 2008, IIS 7

    Read the article

  • On checking is a port open on the firewall?

    - by [email protected]
    Hi, well sometimes DBAs and sysadmin need to check if a particular port is "open" on the corporate firewall --i.e. *Grid Control* Will the communication between OMS and a management agent work? --One solution well consist on deploying the piece of software in question, start it and just check if everything works fine, however i find more classy trying to get that information beforeThere are several tools for doing so --i.e. nmap *like Trinity on The Matrix*, but just found a nice piece of code for establishing a socket on a parameter passed port.After running the program doing a telnet from the client machine  will be a walk in the park Normal 0 21 false false false MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;} #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> int main(int argc, char *argv[]) {      int sockfd, newsockfd, portno, clilen;      char buffer[256];      struct sockaddr_in serv_addr, cli_addr;      int n;      if (argc < 2) {          fprintf(stderr,"ERROR: A port must be provided. Aborting ...\n");          return 1;      }      sockfd = socket(AF_INET, SOCK_STREAM, 0);      if (sockfd < 0)          {         fprintf("ERROR: Unable to open socket. Aborting ...\n");         return 1;       }      portno = atoi(argv[1]);      serv_addr.sin_family = AF_INET;      serv_addr.sin_addr.s_addr = INADDR_ANY;      serv_addr.sin_port = htons(portno);      if (bind(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)          {               fprintf("ERROR: Unable to bind socket. Aborting ...\n");               return 1;       }      listen(sockfd,5);      clilen = sizeof(cli_addr);      newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr,&clilen);      if (newsockfd < 0)          {           fprintf("ERROR: Unable to accept connection. Aborting...\n");           return 1;        }      return 0; }Of course, you can still ask to the network guy if the port is open or notHope it helpsL

    Read the article

  • Python: Socket set source port number

    - by beratch
    Hi all, I'd like to send a specific UDP broadcast packet.. unfortunatly i need to send the udp packet from a very specific port for all packet I send. Let say I broadcast via UDP "BLABLAH", the server will only answer if my incoming packet source port was 1444, if not the packet is discarded. My broadcast socket setup look like this : s = socket(AF_INET,SOCK_DGRAM) s.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) How can i do that (set the source port) in python ? Thanks!

    Read the article

  • Parallel port recording to file on Win XP

    - by Nikola Kotur
    Hi there. I need to write a simple program that records all the input from parallel port into a file. Data flows from industrial machine, setup is fairly simple, but I can't find any good open source examples on parallel port reading for Windows. Do you know a software that does this (and lets me learn how to do it myself), or is there any guideline for parallel port programming on XP? Thanks.

    Read the article

  • Programmatically talking to a Serial Port in OS X or Linux

    - by deadprogrammer
    I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . When i do this everything seems to be hunky-dory: stty -f /dev/cu.usbserial speed 9600 baud; lflags: -icanon -isig -iexten -echo iflags: -icrnl -ixon -ixany -imaxbel -brkint oflags: -opost -onlcr -oxtabs cflags: cs8 -parenb Everything also works when I use the serial port tool to talk to it. If I run this piece of code while the above mentioned serial port tool, everthing also works. But as soon as I disconnect the tool the connection gets lost. #!/usr/bin/python import serial ser = serial.Serial('/dev/cu.usbserial', 9600, timeout=10) ser.write("<ID01><PA> \r\n") read_chars = ser.read(20) print read_chars ser.close() So the question is, what magicks do I need to perform to start talking to the serial port without the serial port tool? Is that a permissions problem? Also, what's the difference between /dev/cu.usbserial and /dev/tty.usbserial?

    Read the article

  • Issues writing to serial port on MAC OSX using unistd.h in c

    - by Schuyler
    I am trying to write to a bluetooth device on MAC OSX using the unistd.h Linux functions in c. I am connecting fine and writing the first few bytes with success. When I try to write other commands to it (there are bytes added to the write buffer every 15ms), I don't see any results even though the write() function returns 1 (write success). If you start a write and it doesn't finish by the time you try to start another write (since it is non-blocking), could that possibly screw up the initial write? (If so, is there any way to check if a write has completed?) That is the only thing I can think of since the writes are occurring fairly frequently and the first two are successfully sent. qwbyte() simply adds a byte to the output array and increments its length The open port function: BAMid = -1; struct termios options; struct termios originalTTYAttrs; // Open the serial port read/write, nonblocking, with no controlling terminal, and don't wait for a connection. BAMid = open(strPath, O_RDWR | O_NOCTTY | O_NONBLOCK); if (BAMid == -1) { printf("Error opening serial port %s - %s(%d).\n", strPath, strerror(errno), errno); goto error; } // Issue TIOCEXCL ioctl to prevent additional opens except by root-owned processes. if (ioctl(BAMid, TIOCEXCL) == -1) { printf("Error setting TIOCEXCL on %s - %s(%d).\n", strPath, strerror(errno), errno); goto error; } // Get the current options and save them so we can restore the default settings later. if (tcgetattr(BAMid, &originalTTYAttrs) == -1) { printf("Error getting tty attributes %s - %s(%d).\n", strPath, strerror(errno), errno); goto error; } // The serial port attributes such as timeouts and baud rate are set by modifying the termios // structure and then calling tcsetattr() to cause the changes to take effect. Note that the // changes will not become effective without the tcsetattr() call. options = originalTTYAttrs; // Set raw input (non-canonical) mode, with reads blocking until either a single character // has been received or a one second timeout expires. [should be moot since we are leaving it as nonblocking] cfmakeraw(&options); options.c_cc[VMIN] = 1; options.c_cc[VTIME] = 10; cfsetspeed(&options, B57600); // Set 57600 baud options.c_cflag |= CS8; // Use 8 bit words // Cause the new options to take effect immediately. if (tcsetattr(BAMid, TCSANOW, &options) == -1) { printf("Error setting tty attributes %s - %s(%d).\n", strPath, strerror(errno), errno); goto error; } //flush old transmissions if (tcflush(BAMid,TCIOFLUSH) == -1) { printf("Error flushing BAM serial port - %s(%d).\n", strerror(errno), errno); } oBufLength = 0; // Ask it to start if (! qwbyte(CmdStart) ) { goto error; } if (! qwbyte(CmdFull) ) { goto error; } //this transmit works txbytes(); printf("success opening port!"); return -1; // Failure path error: if (BAMid != -1) { close(BAMid); } printf("returning an error--%d",errno); return errno; } The write function (txbytes): int i, bufSize, numBytes; if(oBufLength != 0) { //if the output array isn't empty //duplicating the output array and its size so it can //be overwritten while this write is occuring printf("about to transmit: "); for(i = 0; i < oBufLength; i++) { printf(" %u",oBuf[i]); tempBuf[i] = oBuf[i]; } printf("\n"); bufSize = oBufLength; oBufLength = 0; numBytes = write(BAMid, &tempBuf, bufSize); printf("bytes written = %d\n",numBytes); if (numBytes == -1) { printf("Error writing to port - %s(%d).\n", strerror(errno), errno); } return (numBytes 0); } else { return 0; }

    Read the article

  • How to send a reply message to sender machine via serial port using c#

    - by karthik
    I am using the below code to receive the message via serial port which is working fine. Now i need to send back a acknowledgment message to the sender machine. How can send the message ? private void MonitorSP_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { System.IO.Ports.SerialPort SP = (System.IO.Ports.SerialPort)sender; //Get the ports available in system string[] theSerialPortNames = System.IO.Ports.SerialPort.GetPortNames(); string strAvlPortNames = ""; foreach (string s in theSerialPortNames) { strAvlPortNames += s.ToString() + ", "; } //Read an contruct the message Thread.Sleep(1000); string msg = SP.ReadExisting(); string ConstructedMsg = "Port's Found : " + strAvlPortNames + "\n" + "Port Used : " + SP.PortName + "\n" + "Message Received : " + msg; if (InvokeRequired) { richTextBox1.Invoke(new MethodInvoker(delegate { richTextBox1.Text = ConstructedMsg; })); //Send acknowlegement to sender port SP.Write(SP.PortName); return; } } catch (Exception ex) { MessageBox.Show(ex.StackTrace.ToString()); } }

    Read the article

  • serial port in C

    - by user222820
    I have written a program in C to send a byte to serial port (com). I have used BIOSCOM to send data but I guess that it doesn't open the port. Please tell how I can open and close a com port in C. My code is here: #define COM1 1; bioscom (1 , 65 , COM1); Please help me...

    Read the article

  • timing of reads from serial port on windows

    - by Marcin K
    I'm trying to implement a protocol over serial port on a windows(xp) machine. The problem is that message synchronization in the protocol is done via a gap in the messages, i.e., x millisecond gap between sent bytes signifies a new message. Now, I don't know if it is even possible to accurately detect this gap. I'm using win32/serport.h api to read in one of the many threads of our server. Data from the serial port gets buffered, so if there is enough (and there will be enough) latency in our software, I will get multiple messages from the port buffer in one sequence of reads. Is there a way of reading from the serial port, so that I would detect gaps in when particular bytes were received?

    Read the article

  • C# check if a COM (Serial) port is already open

    - by TK
    Is there an easy way of programmatically checking if a serial COM port is already open/being used? Normally I would use: try { // open port } catch (Exception ex) { // handle the exception } However, I would like to programatically check so I can attempt to use another COM port or some such.

    Read the article

  • Lexmark X5650 doesn't print (scanning works)

    - by unor
    I want to use a Lexmark X5650 under Ubuntu. When I connect it via USB, Ubuntu recognizes the device, but can't find a driver. On the Lexmark support site, you can select "Unix/Linux" and then "Ubuntu 9.04", "9.10", "10.04" and "10.10". However, all versions lead to the same driver: lexmark-08z-series-driver-1.0-1.i386.deb.sh.tar.gz (Last updated: 2012-04-13). While installing this driver, the installer asks me to connect the device. As soon as I connect it via USB, Ubuntu now adds the printer automatically. So after the installation completed, I had 2 printers set up. But I can't print anything (I tried it with both printer configurations). Scanning works fine, though. So I guess the driver installation and the device connection are successful. When I try to print something, the print job is listed in the printing queue, but nothing happens. After some time, I get an error message which starts a debug wizard, but in the end it reads something like "Sorry, couldn't find the reason". I had several different error messages (unfortunately, I didn't record them), one was approximately like "printer cannot communicate with computer". Another said that my color ink was low (which is true, but black is full). Another said there was an input/output error. I tried it with Ubuntu 11.10. Because I read that some people had success with 10.04., I installed it in QEMU and installed the driver there, too. Same problem, though. I'd like to upgrade to 12.04, if it should work there for any reason, but I read that for some people this printer stopped working in 12.04 :/ So, it would be best if the printer would work in 12.04. If that's not possible, I'd be fine with starting a QEMU virtual machine with any GNU/Linux distribution that works with my printer.

    Read the article

  • TCP port are filtered in VirtualBox

    - by iUngi
    I'm running Ubuntu using VirtualBox to test a server application, but I couldn't get it work the communication. I used nmap to check whether the port is open or not: nmap -T4 -n vbip -p 30000 Host is up (0.00061s latency). PORT STATE SERVICE 30000/tcp filtered unknown when I'm checking the port inside the VirtualBox, than the port is open Host is up (0.00061s latency). PORT STATE SERVICE 30000/tcp open unknown I'm using bridge connection, does the VB filter the ports?

    Read the article

  • Difference between a socket and a port

    - by cobie
    Could someone please explain quite clearly the difference between a port and a socket. I know that a port serves as a door into the network for an application process and that the application process uses a socket connection to the given port number to handle network communication but when you have multiple processes listening on a single port number, I am finding it difficult to understand the difference between the socket and the port and how they all fit together.

    Read the article

  • Listening for TCP and UDP requests on the same port

    - by user339328
    I am writing a Client/Server set of programs Depending on the operation requested by the client, I use make TCP or UDP request. Implementing the client side is straight-forward, since I can easily open connection with any protocol and send the request to the server-side. On the servers-side, on the other hand, I would like to listen both for UDP and TCP connections on the same port. Moreover, I like the the server to open new thread for each connection request. I have adopted the approach explained in: link text I have extended this code sample by creating new threads for each TCP/UDP request. This works correctly if I use TCP only, but it fails when I attempt to make UDP bindings. Please give me any suggestion how can I correct this. tnx Here is the Server Code: public class Server { public static void main(String args[]) { try { int port = 4444; if (args.length > 0) port = Integer.parseInt(args[0]); SocketAddress localport = new InetSocketAddress(port); // Create and bind a tcp channel to listen for connections on. ServerSocketChannel tcpserver = ServerSocketChannel.open(); tcpserver.socket().bind(localport); // Also create and bind a DatagramChannel to listen on. DatagramChannel udpserver = DatagramChannel.open(); udpserver.socket().bind(localport); // Specify non-blocking mode for both channels, since our // Selector object will be doing the blocking for us. tcpserver.configureBlocking(false); udpserver.configureBlocking(false); // The Selector object is what allows us to block while waiting // for activity on either of the two channels. Selector selector = Selector.open(); tcpserver.register(selector, SelectionKey.OP_ACCEPT); udpserver.register(selector, SelectionKey.OP_READ); System.out.println("Server Sterted on port: " + port + "!"); //Load Map Utils.LoadMap("mapa"); System.out.println("Server map ... LOADED!"); // Now loop forever, processing client connections while(true) { try { selector.select(); Set<SelectionKey> keys = selector.selectedKeys(); // Iterate through the Set of keys. for (Iterator<SelectionKey> i = keys.iterator(); i.hasNext();) { SelectionKey key = i.next(); i.remove(); Channel c = key.channel(); if (key.isAcceptable() && c == tcpserver) { new TCPThread(tcpserver.accept().socket()).start(); } else if (key.isReadable() && c == udpserver) { new UDPThread(udpserver.socket()).start(); } } } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); System.err.println(e); System.exit(1); } } } The UDPThread code: public class UDPThread extends Thread { private DatagramSocket socket = null; public UDPThread(DatagramSocket socket) { super("UDPThread"); this.socket = socket; } @Override public void run() { byte[] buffer = new byte[2048]; try { DatagramPacket packet = new DatagramPacket(buffer, buffer.length); socket.receive(packet); String inputLine = new String(buffer); String outputLine = Utils.processCommand(inputLine.trim()); DatagramPacket reply = new DatagramPacket(outputLine.getBytes(), outputLine.getBytes().length, packet.getAddress(), packet.getPort()); socket.send(reply); } catch (IOException e) { e.printStackTrace(); } socket.close(); } } I receive: Exception in thread "UDPThread" java.nio.channels.IllegalBlockingModeException at sun.nio.ch.DatagramSocketAdaptor.receive(Unknown Source) at server.UDPThread.run(UDPThread.java:25) 10x

    Read the article

  • Windows with putty via USB serial cable to Linux serial port - output ok, input isn't

    - by Aharon Robbins
    I am trying to get two way serial communications going between a Windows XP system and a Linux system (RHEL 5). I have /sbin/agetty -L 9600 ttyS0 in /etc/inittab. I am using a generic USB to serial adaptor on Windows (Unitek) and a null modem cable. I have putty configured for 9600 baud, 8 bits, no parity, one stop bit, no flow control. I get the login prompt from agetty in the putty window but input does not work; I see weird characters in the putty screen. I can echo output into the device from windows and see it, but cat < /dev/ttyS0 just prints out weird characters from what I type. Any and all suggestions will be welcome. Thanks!

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >