windows环境下的socket nc 测试小工具nc -L -p 9999

来源:互联网 发布:海量数据和数据港 编辑:程序博客网 时间:2024/06/09 16:05

windows环境下的socket nc  测试小工具nc -L -p 9999

 

在windows本地 进行测试,发送socket包到是怕人看streaming。少了这个工具还真不方便。

 

nc.exe网上下载,保存在C:\nc.exe;同时也保存一份放到了百度云盘,我的实验目录里面

 

操作步骤:

1. cd  C:\nc.exe

2 , 启动eclipse的spark streaming

3、再执行 nc -L -p 9999 -v ;手工输入数据

     或者导入一个文件


nc -L -p 9999 -v < C:\nc.exe\IMFtestdata.txt

 

sparkstreaming的服务器不能写127.0.0.1,要写hostname的名字pc

  JavaReceiverInputDStream<String> lines = ssc.socketTextStream(
             //args[0], Integer.parseInt(args[1]), StorageLevels.MEMORY_AND_DISK_SER);
    "pc", 9999, StorageLevels.MEMORY_AND_DISK_SER);
     JavaDStream<String> words = lines.flatMap(new FlatMapFunction<String, String>() {

 

 

 

 

 

0 0