AgNO3 / junixsocket

Java Unixsocket Library
Other
2 stars 4 forks source link

supporting Dgram on junixSocket #1

Closed dnagaraj1986 closed 8 years ago

dnagaraj1986 commented 8 years ago

how to process dgrampackets for UDS connection with junixsocket sock.bind(new AFUNIXSocketAddress(socketFile, 0, false, true)); And i do receive dgram packets socket = sockt.getInputStream(). I would like to process these similar to DgraPackets. How to do it?

mbechler commented 8 years ago

If you do something like

socket.bind(new AFUNIXSocketAddress(socketFile, 0, false, true)); AFUnixSocket s = socket.accept(); InputStream in = s.getInputStream(); byte[] buffer = new byte[MSG_SIZE]; int msgLen = in.read(buffer);

a single read will return you a single message. Is that what you are looking for? The accept call might seem unnecessary, and it actually doesn't perform an accept() for dgram, but that was the simplest way to implement it.

dnagaraj1986 commented 8 years ago

yes exactly thanks. Its working for me