Created
March 8, 2019 12:10
-
-
Save tanghaodong25/8f63c607dd42d9a2189afc688b5c1507 to your computer and use it in GitHub Desktop.
HPNL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Client { | |
public static void main(String args[]) { | |
EqService eqService = new EqService(addr, "123456", 1, bufferNbr, false).init(); | |
CqService cqService = new CqService(eqService, eqService.getNativeHandle()).init(); | |
List<Connection> conList = new CopyOnWriteArrayList<Connection>(); | |
ConnectedCallback connectedCallback = new ConnectedCallback(conList, false); | |
ReadCallback readCallback = new ReadCallback(false, eqService); | |
ShutdownCallback shutdownCallback = new ShutdownCallback(); | |
eqService.setConnectedCallback(connectedCallback); | |
eqService.setRecvCallback(readCallback); | |
eqService.setShutdownCallback(shutdownCallback); | |
eqService.initBufferPool(bufferNbr, bufferSize, bufferNbr); | |
eqService.start(); | |
cqService.start(); | |
eqService.waitToConnected(); | |
for (Connection con: conList) { | |
RdmaBuffer buffer = con.takeSendBuffer(true); | |
buffer.put(byteBufferTmp, (byte)0, 10); | |
con.send(buffer.remaining(), buffer.getRdmaBufferId()); | |
} | |
cqService.join(); | |
eqService.shutdown(); | |
eqService.join(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Server { | |
public static void main(String args[]) { | |
EqService eqService = new EqService(addr, "123456", workNbr, bufferNbr, true).init(); | |
CqService cqService = new CqService(eqService, eqService.getNativeHandle()).init(); | |
List<Connection> conList = new ArrayList<Connection>(); | |
ConnectedCallback connectedCallback = new ConnectedCallback(conList, true); | |
ReadCallback readCallback = new ReadCallback(true, eqService); | |
eqService.setConnectedCallback(connectedCallback); | |
eqService.setRecvCallback(readCallback); | |
eqService.initBufferPool(bufferNbr, bufferSize, bufferNbr); | |
eqService.start(); | |
cqService.start(); | |
cqService.join(); | |
eqService.shutdown(); | |
eqService.join(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment