简体   繁体   中英

java.io Socket to node.js

I am trying to create a node.js command-line client for a semi-populated chat site "SpinChat". I've been doing a little research, and found that many java clients have been made using java.io. I however, wish to use node.js.

With Java.io, i can connect to a chat server like so:

new Socket("www.spinchat.com", 3001); 

I need to be able to do with in node.js, and am not quite sure how. I wish i could provide more information... but I'm hoping the answer is really simple.. perhaps a node.js edition of java.io?

According to node.js docs , you can open a socket like this

var socket = new net.Socket();
socket.connect(3001, "www.spinchat.com");

Here you can find additional details about the socket initialization and here you can find additional detalis about the connect() function

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM