Questions tagged [socketchannel]

Issues related to socket channel for stream-oriented connecting sockets in Java

A socket channel represents a "selectable channel" for stream-oriented connecting sockets in Java. It is part of the Java NIO library.

249 questions
1
vote
0 answers

How to use Conscrypt library for ssl socketchannel in android?

On the conscrypt git page , there are no sample usage available to use the conscrypt for ssl socketChannel with sslEngine. Could anyone please provide sample usage example or guide me how to use conscrypt to make NIO socketchannel tcp socket with…
Ashok Kumar
  • 1,226
  • 1
  • 10
  • 14
1
vote
1 answer

Using Selector on SocketChannel

I'm trying to wait on multiple socket channels for data to read. I've copied example code from the web but it's not working for me. The problem is that the "select" call properly blocks until the first data is received, but thereafter immediately…
DontPanic
  • 2,164
  • 5
  • 29
  • 56
1
vote
0 answers

Android NIO- Not able to read large data from SocketChannel, Error: BUFFER_UNDERFLOW

We are trying to read large amount of data through NIO TCPs SocketChannel. Code is working for small amount of data(less than 16KB), but above than first it read 16KB into destination buffer again try to read for remaining data it gives…
1
vote
1 answer

django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'project.routing'

I have installed django channels and I have added routing.py in project root folder and added the line ASGI_APPLICATION = 'project.routing.application' but whenever i tried to run the server i get raise ImproperlyConfigured("Cannot import…
john
  • 539
  • 2
  • 9
  • 24
1
vote
0 answers

Will SelectionKey.isWritable return false for socket channel in java nio?

If we register OP_WRITE on a SocketChannel, it seems selectionKey.isWritable() method always return TRUE. Will there be any specific scenario that it returns FALSE for a socket channel?
Alendi
  • 21
  • 1
1
vote
0 answers

How to send a string through non blocking socketchannel

I am having a problem with SocketChannel in a client-server java application. In the server, first of all, I initialize the selector: Selector selector = null; try{ ServerSocketChannel serverSocketChannel = ServerSocketChannel.open(); …
Lorenzo
  • 215
  • 4
  • 10
1
vote
0 answers

Java NIO socket blocking channel is connected/open

Currently in our application , we use java nio blocking socket channel for writing data out. socketChannel = SocketChannel.open(); socketChannel.setOption(StandardSocketOptions.SO_KEEPALIVE, config.getConnectionKeepAlive()); …
eprabab
  • 101
  • 6
1
vote
1 answer

Java: How can I send message to all channels from NIO Server

Is there any functionality provided by NIO package for sending messages to all active ClientChannels? I can just loop through all the keys anytime I am reading from some Channel, like it is done here, but I am interested in using specifically NIO…
Mikayel
  • 117
  • 11
1
vote
0 answers

Continuous reads from socketchannel into bytebuffer

I'm trying to get all the data from a SocketChannel into a ByteBuffer. Since I may be getting different length messages from the channel, I'd like to loop until a read returns me 0 bytes, in which case I know I'm done and that all data is now in the…
1
vote
1 answer

ServerSocketChannel vs ServerSocket Java

I have started my work on a pre-developed Java application, where they are dealing with java sockets. The main concept of the project is to get data from the client at the java socket server and process it. The project has been developed using Java…
Jay Vyas
  • 2,674
  • 5
  • 27
  • 58
1
vote
0 answers

Byte Buffer Is getting Corrupts in TCP Response

I have have Tcp Server public class SomeServer implements Runnable{ private static final int BUFFER_SIZE = 4096; private Selector selector; private int port; private boolean runserver = true; private ServerSocketChannel…
edwin
  • 7,985
  • 10
  • 51
  • 82
1
vote
1 answer

'Feeding' a Netty 4 pipeline without a socket

I have a set of Netty 4 handlers that I normally chain on top of a ServerBootstrap using EpollEventLoopGroups. However the source of the data will not be a socket; instead I will read from / write to two in-memory buffers. Solution can be…
kubuzetto
  • 1,046
  • 1
  • 12
  • 31
1
vote
1 answer

SocketChannel: not enough bytes read

I'm implementing a client server communication via socketChannel. During load tests with larger objets I run into problems on the client side. So I've implemented a test program to verify my problem an to illustrate it here. First a small…
Jürgen
  • 146
  • 12
1
vote
1 answer

Java NIO loops on socketChannel.read()

I'm trying to understand where is the error without success. The scenario is a client that connects to a server that receive a file, a sort of "upload". The server then open a FileChannel, reads all the data and store it in a buffer that is copied…
alessandro308
  • 1,912
  • 2
  • 15
  • 27
1
vote
0 answers

SocketChannel write more than 1 response

I am writing dummy server for my project to accept request from client and return 1 or more responses back. On the dummy server side, it gets the request from client, and find the matched message to send back. Below is piece of code of writing…
Bmegod
  • 35
  • 7