473,388 Members | 1,198 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,388 software developers and data experts.

SocketChannel problem

7
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


Expand|Select|Wrap|Line Numbers
  1.         address = new InetSocketAddress("***.***.**.**",**** );
  2.         channel = SocketChannel.open(address);              
  3.         byte[] b = getAuthenticationLoginString("***","********");
  4.         ByteBuffer bbuf = ByteBuffer.allocate(b.length);
  5.         bbuf.put(b);
  6.         channel.write(bbuf);        
  7.         channel.configureBlocking(false);
  8.  
  9.         Thread.sleep(2000);        
  10.         ByteBuffer responsebuf = ByteBuffer.allocateDirect(1024);
  11.         int n = channel.read(responsebuf);
  12.         System.out.println(n);
  13.         if(n < 0 )
  14.             channel.close();
  15.         else
  16.         {
  17.             byte[] v = new byte[1024];
  18.             responsebuf.get(v);
  19.             String returnString = decryptReturnedResponse(v);
  20.         }  
Oct 23 '07 #1
3 1707
JosAH
11,448 Expert 8TB
Does it work when you use an ordinary Socket that you bind to your server?

kind regards,

Jos
Oct 23 '07 #2
green
7
Does it work when you use an ordinary Socket that you bind to your server?

kind regards,

Jos

No, It does not work

I have a big problem withe the ordinary socket
Oct 23 '07 #3
JosAH
11,448 Expert 8TB
No, It does not work

I have a big problem withe the ordinary socket
So if you try to connect an ordinary socket to your server it fails?

kind regards,

Jos
Oct 23 '07 #4

Sign in to post your reply or Sign up for a free account.

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: Iain Bethune | last post by:
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 =...
0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.