chat

combine netcat with chat on bash for automatic udp responses

前提是你 提交于 2019-12-24 03:08:26
问题 I want to combine "chat" and "nc" on linux, so I will create a tiny udp server that responds on a specific request and sends back an answer. In fact I want to redirect the stdout of "nc" to the stdin of "chat" and vice versa. My first attempt was: nc -w 3000 -u -n -l -p 30000 >&1111 <2222 & chat -V 'request' 'answer' >&2222 <1111 But it didn't work. 回答1: use socat instead of netcat. Something like this : socat UDP-LISTEN:5555 EXEC:"chat -sv ping pong",pty To test it, you can open another

Java NIO Server/Client Chat App - sending data only by closing the socket

浪子不回头ぞ 提交于 2019-12-24 02:17:18
问题 friends! I'm new to Java NIO and I'm currently trying to make a non-blocking chat app. The client connects to the server without problem. The client writes a message or few messages to the server but the server starts reading the messages only when the Socket connection is closed from the client code, so a SocketChannel (or only Socket) must be created and closed in the client code for every message - this doesn't seems to me right. I've tried the client side with simple Java I/O and also

Android - How to keep connection with server for a long time

天涯浪子 提交于 2019-12-24 02:15:02
问题 I wrote a chat application for Android using SocketChannel. It connects successfully with the server and all features work. But after a long time since I logged in (about 2-3 hours), I try to send a chat message again and it fails. In log file, SocketChannel, selector still open and connect to server, message already write successful. What's the problem? What am I missing? Thanks in advance for your help. 回答1: if you want to create a Chat for android or something else with push from a server,

Comet vs Ajax for chatting

痴心易碎 提交于 2019-12-24 00:41:54
问题 My site needs a chat room, and I'm also looking to implement a facebookesque person to person chat system. What is most cost-efficient/performant (purely in terms of bw and server) for me. A regular 1 second poll ajax chat, or a comet solution. Thanks. 回答1: Comet would typically result in lower bandwidth usage (assuming less than 1 chat message per second per chat on average), owing to the fact that it will only query the server once per message sent. It would typically result in more

What is the best approach to develop a video chat web application in Java? Flex or JMF?

廉价感情. 提交于 2019-12-23 22:38:43
问题 Currently we are in the design phase of an application that will allow two users to communicate with each other using chat and video (with audio), the application is a web application that currently is a java web app with Spring and hibernate, but we want to incorporate video and chat between two users and we are evaluating the options to developing it, so far we have two choices, either develop a Flex UI that leverages its video and chatting capabilities through Red5 or something like that

Spring boot 工具类静态属性注入及多环境配置

末鹿安然 提交于 2019-12-23 21:37:21
由于需要访问MongoDB,但是本地开发环境不能直接连接MongoDB,需要通过SecureCRT使用127.0.0.2本地IP代理。但是程序部署到线上生产环境后,是可以直接访问MongoDB的,因此开发好程序后,总是要修改一下MongoDB服务器的IP才能提交代码,这样很是不方便。 private static final String PUBCHAT_HOST = "127.0.0.2"; // private static final String PUBCHAT_HOST = "PROD_MONGO_SERVER_IP"; 由于没有使用spring-boot自带的 spring-boot-starter-data-mongodb ,而是使用 mongo-java-driver 访问MongoDB,因此在程序中需要定义一些访问MongoDB的配置,比如服务器地址、IP端口、数据库名……使用一个工具类的静态变量声明这些配置信息,配置信息的值保存在application.yml 配置文件中。通过 @ConfigurationProperties 注入。 静态工具类定义 属性是静态的: private static String chat_username; 然后通过非静态的 set方法注入: @Value("${mongo.config.username}") public

using XMPP or WebSocket, why there is a server needed in real-time communication between users?

倾然丶 夕夏残阳落幕 提交于 2019-12-23 12:53:46
问题 At the bottom, it's all about socket communications. If there is some way to get the ip of the both users, why can't the connection be directly setup between the users instead of having to go thru a server in the middle? 回答1: My 2 cents: No one out there forces us to have a server based real-time communication model. Infact XMPP have an extension called "Serverless Messaging" which defines how to communicate over local or wide-area networks using the principles of zero-configuration

socket.io error - web socket connection is closed before the connection is established

耗尽温柔 提交于 2019-12-23 10:51:28
问题 I learned a bit from this page - > https://github.com/Automattic/socket.io/issues/1846 Do I need SSL for sockets to work? I've been struggling with this error for a long time with no solution so far, can any geniuses out there to solve the puzzle? My App Code var express = require("express"); var app = express(); var http = require('http').Server(app); var io = require('socket.io')(http); app.use(express.static(__dirname + '/html')); http.listen(process.env.PORT || 3000, function(){ console

React native flatlist initial scroll to bottom

巧了我就是萌 提交于 2019-12-23 07:46:05
问题 I am trying to create a chat in React native using a <Flastlist /> Like whatsapp and other chat apps, the messages start at the bottom. After fetching the messages from my API, I call this.myFlatList.scrollToEnd({animated: false}); But it scrolls to somewhere in the middle and sometimes with fewer items to the bottom and sometimes it does nothing. How can I scroll initially to the bottom? My chat messages have different heights, so I can't calculate the height. 回答1: I had similar issue. If

iOS - Chat application with push notification

大憨熊 提交于 2019-12-23 07:02:34
问题 My question is simple, is it a good idea to develop chat application using push notifications? Hence push notifications are not reliable and there is no guaranty either they would arrive or not. If it is not reliable, which technique should be used for real time chat application? 回答1: Why not? It's definitely possible to build a chat using iOS push notifications. @Aaron points are interesting, but don't make sense in my opinion for the following reasons: If your app sends too many push