nils
New Member
Posts: 14
|
Post by nils on Nov 16, 2008 7:55:14 GMT -5
just a place holder . If i get lazy enough I'll figure out how to post w/o logging in
|
|
nils
New Member
Posts: 14
|
Post by nils on Nov 18, 2008 0:44:27 GMT -5
using System; using System.Net; using System.Net.NetworkInformation; using System.Text;
namespace Examples.System.Net.NetworkInformation.PingTest { public class PingExample { // args[0] can be an IPaddress or host name. public static void Main (string[] args) { Ping pingSender = new Ping (); PingOptions options = new PingOptions ();
// Use the default Ttl value which is 128, // but change the fragmentation behavior. options.DontFragment = true;
// Create a buffer of 32 bytes of data to be transmitted. string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; byte[] buffer = Encoding.ASCII.GetBytes (data); int timeout = 120; PingReply reply = pingSender.Send (args[0], timeout, buffer, options); if (reply.Status == IPStatus.Success) { Console.WriteLine ("Address: {0}", reply.Address.ToString ()); Console.WriteLine ("RoundTrip time: {0}", reply.RoundtripTime); Console.WriteLine ("Time to live: {0}", reply.Options.Ttl); Console.WriteLine ("Don't fragment: {0}", reply.Options.DontFragment); Console.WriteLine ("Buffer size: {0}", reply.Buffer.Length); } } } }
|
|
|
Post by randomnoise2 on Nov 20, 2008 19:27:42 GMT -5
I saw code and was like "Whoa dude! Wrong board." I had to look several times to make sure I was in the right place.
|
|
|
Post by UDP on Dec 2, 2008 20:04:56 GMT -5
Imports System.Threading Imports System.Net.Sockets Imports System.IO
Public Class MainClass Shared Dim output As NetworkStream
Shared Dim writer As BinaryWriter Shared Dim reader As BinaryReader
Shared Dim message As String = "" Shared Dim readThread As Thread
Public Shared Sub Main()
readThread = New Thread(AddressOf RunClient)
readThread.Start()
Try writer.Write("CLIENT>>> ") Console.WriteLine("CLIENT>>> ") Catch exception As SocketException Console.WriteLine("Error writing object") End Try
End Sub Shared Public Sub RunClient() Dim client As TcpClient Try Console.WriteLine("Attempting connection" )
client = New TcpClient() client.Connect("localhost", 5000)
output = client.GetStream()
writer = New BinaryWriter(output) reader = New BinaryReader(output)
Console.WriteLine("Got I/O streams")
Try Do message = reader.ReadString Console.WriteLine(message)
Loop While message <> "SERVER>>> TERMINATE"
Catch inputOutputException As IOException Console.WriteLine("Client application closing")
Finally Console.WriteLine("Closing connection.")
writer.Close() reader.Close() output.Close() client.Close()
End Try
Catch inputOutputException As Exception Console.WriteLine("Client application closing")
End Try
End Sub
End Class
|
|
nils
New Member
Posts: 14
|
Post by nils on Dec 18, 2008 11:08:49 GMT -5
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.IO; using System.Text; using System.Xml; using System.Xml.Serialization; using System.Net;
public partial class SendStream : System.Web.UI.Page {
HttpWebRequest MyRequest; #region Page_Load protected void Page_Load(object sender, EventArgs e) {
} #endregion
#region Send_Stream protected void Button1_Click(object sender, EventArgs e) { try { using(SqlConnection SQLCon = new SqlConnection(”server=.;database=TEST;user id=sa;password=sa”)) {
SQLCon.Open(); string Str = “SELECT * FROM CATEGORY AS CATEGORY”; SqlCommand SQLCmd = new SqlCommand(Str, SQLCon); DataSet Ds = new DataSet(); SqlDataAdapter SQLAdapter = new SqlDataAdapter(SQLCmd); SQLAdapter.Fill(Ds, “Category”); ASCIIEncoding Encoding = new ASCIIEncoding(); byte[] Data = Encoding.GetBytes(Ds.GetXml()); MyRequest = (HttpWebRequest)WebRequest.Create(”http://localhost:3665/WEbsite1/ReceiveStream.aspx”); MyRequest.Method = “Post”; MyRequest.ContentLength = Data.Length; MyRequest.ContentType = “application/xml”; MyRequest.KeepAlive = false; //Send the Stream using(Stream RequestStream=MyRequest.GetRequestStream()) { RequestStream.Write(Data, 0, Data.Length); } //Read the Response. string Response_Xml = string.Empty; using(HttpWebResponse MyResponse=(HttpWebResponse)MyRequest.GetResponse()) { using (Stream ResponseStream =MyResponse.GetResponseStream()) { using(StreamReader ResponseStreamReader=new StreamReader(ResponseStream)) { Response_Xml = ResponseStreamReader.ReadToEnd(); } }
}
}
} catch (Exception Ex) { throw new Exception(Ex.Message); }
} #endregion }
|
|
|
Post by dortress on Dec 18, 2008 13:14:22 GMT -5
SELECT * FROM users WHERE clue > 0
|
|
|
Post by golfwidow72 on Dec 30, 2008 14:29:39 GMT -5
My company is now blocking groups.msn.com for being a "dating" site (?).
Booooo.
|
|