473,324 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Making a readable SocketChannel (using NIO package)

I am having a problem with creating a SocketChannel which can read
data. Here is the
relevant code snippet (from the code for my networking client):

SocketChannel channel = SocketChannel.open();
channel.configureBlocking(false);

channel.connect(new InetSocketAddress(addr, port));

while(!channel.finishConnect())
try{
Thread.sleep(10);
}catch(InterruptedException e){
System.out.println("Interrupted");
}

channel.register(selector, channel.validOps());

System.out.println("Socket Readable: " +
channel.keyFor(selector).isReadable());

This creates a SocketChannel fine, and I can write data to it (and it
is read by the server fine), but
when I run it I find that the socket is not readable, so I can't send
any data back from the server!

Any ideas what could be going wrong?

Thanks in advance for the help

- Iain
Jul 17 '05 #1
0 2092

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MB | last post by:
I am writing an FTP Client using the NIO packages because I want to use the non-blocking functionality. I have done this successfully except for the fact that after I "put" an image file to the...
0
by: Mark | last post by:
I'm betting it me. Here is the simple schema I'm using: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"...
3
by: Kenneth McDonald | last post by:
This will have an easy answer, no doubt, unfortunately I can't think of it... I'm writing a package which will have a number of classes. I'd like to split them amongst different files within the...
1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
0
by: Jony Joe | last post by:
Dear All; I am now making a deployment package using the .net deployment setup project. It is a desktop application that its solution contains 7 projects that generate DLLs and EXEs...
3
by: Bob Powell | last post by:
Hello everyone; My systems admin says that he needs to have use of the Postgres user without a password. His Debian package manager requires this. He tells me that he can lock down that user...
5
by: Ray Tomes | last post by:
Hi Folks I am an old codger who has much experience with computers in the distant past before all this object oriented stuff. Also I have loads of software in such languages as FORTRAN and...
0
by: krishnakant Mane | last post by:
hello all, I am struggling a bit in making python packages. when I am doing a project I want to create all my python modules inside a single package. I want to know when I make a package, what...
3
by: green | last post by:
dear all , I'm trying to write a socket program . using the SocketChannel... but I don't receive any thing from the server. why ??????? this my code address = new...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.