小编use*_*132的帖子

通过NetworkStream(套接字)编写/读取字符串以进行聊天

对不起,如果这很难理解,第一次尝试C#.

我试图在连接到服务器的客户端之间进行简单的公共"聊天".我已经尝试将整数传递给服务器并打印出来,一切都很好,但是,当我切换到字符串时,它似乎只能传递1个字符(因为ns.Write(converted, 0, 1);).如果我ns.Write(converted,0,10)在输入少于10个字符的消息时将ns.Write增加到一切崩溃(客户端和服务器).

服务器代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net.Sockets;


namespace MultiServeris
{
    class Multiserveris
    {
        static void Main(string[] args)
        {
            TcpListener ServerSocket = new TcpListener(1000);         
            ServerSocket.Start();                                     
            Console.WriteLine("Server started");
            while (true)
            {
                TcpClient clientSocket = ServerSocket.AcceptTcpClient();        
                handleClient client = new handleClient();                       
                client.startClient(clientSocket);
            }
        }
    }

    public class handleClient
    {
        TcpClient clientSocket;
        public void startClient(TcpClient inClientSocket)
        {
            this.clientSocket = inClientSocket;
            Thread ctThread = new Thread(Chat);
            ctThread.Start();
        }
        private void Chat() …
Run Code Online (Sandbox Code Playgroud)

c# sockets string chat networkstream

3
推荐指数
2
解决办法
2万
查看次数

在不从父元素继承颜色之前

如何让'before'三角形继承正方形的颜色?Color:inherit,border-color:inherit,background-color:inherit没有发挥出来.

HTML:

<div class="tag">
   16,00 €
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.tag{
    position:absolute;
    top:20px;
    left:150px;
    display:block;

    width:290px;
    height:100px;
    background-color: orange;
    border-color: orange;

}       
.tag:before{
        color:orange;
        content:"";
        position:absolute;
        left:-50px;
        border-top: 50px solid transparent;
        border-right: 50px solid;
        border-bottom: 50px solid transparent;
    }
Run Code Online (Sandbox Code Playgroud)

小提琴:http://jsfiddle.net/vkw281gL/

html css inheritance pseudo-element

3
推荐指数
1
解决办法
2570
查看次数

标签 统计

c# ×1

chat ×1

css ×1

html ×1

inheritance ×1

networkstream ×1

pseudo-element ×1

sockets ×1

string ×1