Please help me --
transfer Numbers 1 to 100 from client to server using sockets in a console application.
Number one second per second transmitted -
-

Have you tried anything yourself? This sounds like a typical homework assignment. Here are some links that could get you started on building a constructive question and actually post some code of your own.

Link
Link
Link
Link

Yes, I've tried
Client side:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace Client
{
class Program
{
static void Main(string[] args)
{
byte[] data = new byte[5000];
string  stringData;
IPEndPoint ipep = new IPEndPoint(
IPAddress.Parse("127.0.0.1"), 9050);
Socket server = new
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
try
{
server.Connect(ipep);
}
catch (SocketException e)
{
Console.WriteLine("Unable to connect to server.");
Console.WriteLine(e.ToString());
return;
}
int recv = server.Receive(data);
stringData = Encoding.ASCII.GetString(data, 0, recv);
Console.WriteLine(stringData);   
int i = 1;
while (i<=100)
{


    server.Send(BitConverter.GetBytes(i));
i++;
}
Console.WriteLine("Disconnecting from server...");
server.Shutdown(SocketShutdown.Both);
server.Close();
}
}
}

Server side :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
namespace Server
{
class Program
{
static void Main(string[] args)
{
   int  recv ;
byte[] data = new byte[5000];
byte[] amin = new byte[5000];

IPEndPoint ipep = new IPEndPoint(IPAddress.Any,9050);
    Socket newsock = new
Socket(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
newsock.Bind(ipep);
newsock.Listen(10);
Console.WriteLine("Waiting for a client...");
    Socket client = newsock.Accept();
IPEndPoint clientep = (IPEndPoint)client.RemoteEndPoint;
Console.WriteLine("Connected with {0} at port{1}", clientep.Address, clientep.Port);

string welcome = "Welcome to my test server";
data = Encoding.ASCII.GetBytes(welcome);
client.Send(data, data.Length, SocketFlags.None);

    while (true)
{
     amin = new byte[5000];
    recv = client.Receive(amin);

Console.WriteLine(BitConverter.ToInt32(amin, 0));

}
Console.WriteLine("Disconnected from{0}",clientep.Address);
client.Close();
newsock.Close();
}
}
}

So what's the problem? are you receiving errors? or is the code just not working in general?

My problem at the sending and receiving numbers

Does not anyone help?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.