C# e databases Clicca QUI per vedere il messaggio nel forum |
nous |
Avete letture da suggerirmi sull'argomento? |
lorenzo |
Database Programming with C#
Carsten Thomsen
APress L. P.
ISBN: 1590590104
 |
CLod |
lorenzo è la bibbia del C
nn c'è ombra di dubbio |
nous |
Lorenzo hai scritto qualche programma in C# che usa i DB?
Se si me lo faresti leggere?Anche solo per farmi sentire inferiore ;)
(io in cambio posso passarti qualche cosina sui socket in C#)
Riguardo al libro..lo hai letto e me lo suggerisci con cognizione di causa o è il primo che hai trovato su Google :D:D? |
Rifinitore |
Me la passi a me qualche cosina sui socket ?:-D :D |
nous |
Tanto per cominciare...uno stupidissimo client che manda una stringa a un server...questo funge in MSDOS,dopo magari proviamo a farne uno per winzozz più serio ;)
code:
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Net.Sockets;
public class clnt {
public static void Main() {
try {
TcpClient tcpclnt = new TcpClient();
Console.WriteLine("Connecting.....");
//CAMBIARE L'IP,QUESTO E' QUELLO DELLA MIA RETE DI PROVA
//Si collega sulla porta 8001 del server in 172.27.1.60
tcpclnt.Connect("172.27.1.60",8001);
Console.WriteLine("Connected");
Console.Write("Enter the string to be transmitted : ");
String str=Console.ReadLine();
Stream stm = tcpclnt.GetStream();
ASCIIEncoding asen= new ASCIIEncoding();
byte[] ba=asen.GetBytes(str);
Console.WriteLine("Transmitting.....");
stm.Write(ba,0,ba.Length);
byte[] bb=new byte[100];
int k=stm.Read(bb,0,100);
for (int i=0;i<k;i++)
Console.Write(Convert.ToChar(bb[i]));
tcpclnt.Close();
}
catch (Exception e) {
Console.WriteLine("Error..... " + e.StackTrace);
}
}
}
Non so se sai qualcosa di C#,quindi chiedi se hai dubbi.
Se non chiedi,domani posto il server ;) |
|
|
|