Socket.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847
  1. // System.Net.Sockets.Socket.cs
  2. //
  3. // Author:
  4. // Phillip Pearson ([email protected])
  5. //
  6. // Copyright (C) 2001, Phillip Pearson
  7. // http://www.myelin.co.nz
  8. //
  9. // NB: This is untested (probably buggy) code - take care if using it
  10. // Nowhere near finished yet ...
  11. using System;
  12. using System.Net;
  13. using System.Collections;
  14. namespace System.Net.Sockets
  15. {
  16. public class Socket : IDisposable
  17. {
  18. // static method:
  19. /// <summary>
  20. /// Blocks while waiting for readability, writeability or
  21. /// error conditions on a number of sockets
  22. /// </summary>
  23. /// <param name="read_list">A list of sockets to watch
  24. /// for readability</param>
  25. /// <param name="write_list">A list of sockets to watch
  26. /// for writeability</param>
  27. /// <param name="err_list">A list of sockets to watch
  28. /// for errors</param>
  29. /// <param name="time_us">Timeout, in microseconds</param>
  30. public static void Select (
  31. IList read_list,
  32. IList write_list,
  33. IList err_list,
  34. int time_us)
  35. {
  36. throw new NotImplementedException();
  37. }
  38. // public constructor:
  39. /// <summary>
  40. /// Makes a new Socket
  41. /// </summary>
  42. /// <param name="family">Address family (e.g.
  43. /// AddressFamily.InterNetwork for IPv4)</param>
  44. /// <param name="type">Socket Type (e.g. SocketType.Stream
  45. /// for stream sockets)</param>
  46. /// <param name="proto">Protocol (e.g.
  47. /// ProtocolType.Tcp for TCP)</param>
  48. public Socket (
  49. AddressFamily family,
  50. SocketType type,
  51. ProtocolType proto)
  52. {
  53. throw new NotImplementedException();
  54. }
  55. // public properties:
  56. /// <summary>
  57. /// The address family (see contructor)
  58. /// </summary>
  59. public AddressFamily AddressFamily
  60. {
  61. get
  62. {
  63. throw new NotImplementedException();
  64. //return AddressFamily.InterNetwork;
  65. }
  66. }
  67. /// <summary>
  68. /// How much data is waiting to be read (i.e. the amount
  69. /// of data in the in buffer)
  70. /// </summary>
  71. public int Available
  72. {
  73. get {
  74. throw new NotImplementedException();
  75. //return 0;
  76. }
  77. }
  78. /// <summary>
  79. /// A flag to indicate whether the socket is a blocking
  80. /// socket or not. Returns true if blocking.
  81. ///
  82. /// A non-blocking socket (Blocking == false) will return
  83. /// control to the application immediately if any calls are
  84. /// made that may take a while to complete. Blocking
  85. /// sockets will block the app until whatever they are doing
  86. /// is finished.
  87. /// </summary>
  88. public bool Blocking
  89. {
  90. get {
  91. throw new NotImplementedException();
  92. //return false;
  93. }
  94. set { }
  95. }
  96. /// <summary>
  97. /// A flag to say whether the socket is connected to something
  98. /// or not.
  99. ///
  100. /// Returns true if connected.
  101. /// </summary>
  102. public bool Connected
  103. {
  104. get {
  105. throw new NotImplementedException();
  106. //return false;
  107. }
  108. }
  109. /// <summary>
  110. /// A handle to the socket (its file descriptor?)
  111. /// </summary>
  112. public IntPtr Handle
  113. {
  114. get {
  115. throw new NotImplementedException();
  116. //return new IntPtr(0);
  117. }
  118. }
  119. /// <summary>
  120. /// The socket's local endpoint (where it's coming from)
  121. /// </summary>
  122. public EndPoint LocalEndPoint
  123. {
  124. get {
  125. throw new NotImplementedException();
  126. //return new IPEndPoint(0,0);
  127. }
  128. }
  129. /// <summary>
  130. /// Protocol type (e.g. Tcp, Udp)
  131. /// </summary>
  132. public ProtocolType ProtocolType
  133. {
  134. get {
  135. throw new NotImplementedException();
  136. //return ProtocolType.Tcp;
  137. }
  138. }
  139. /// <summary>
  140. /// The socket's remote endpoint (where it's connected to)
  141. /// </summary>
  142. public EndPoint RemoteEndPoint
  143. {
  144. get {
  145. throw new NotImplementedException();
  146. //return new IPEndPoint(0,0);
  147. }
  148. }
  149. /// <summary>
  150. /// Socket type (e.g. datagram, stream)
  151. /// </summary>
  152. public SocketType SocketType
  153. {
  154. get {
  155. throw new NotImplementedException();
  156. //return SocketType.Stream;
  157. }
  158. }
  159. // public methods:
  160. /// <summary>
  161. /// Accepts a new connection
  162. /// </summary>
  163. /// <returns>A new socket to handle the connection</returns>
  164. public Socket Accept ()
  165. {
  166. throw new NotImplementedException();
  167. //return new Socket(AddressFamily.InterNetwork,
  168. // SocketType.Stream, ProtocolType.Tcp);
  169. }
  170. /// <summary>
  171. /// Accepts the connection in the background,
  172. /// calling the application back when finished.
  173. /// </summary>
  174. /// <param name="callback">A delegate to be called
  175. /// when the accept is finished</param>
  176. /// <param name="state">State information for this call</param>
  177. /// <returns></returns>
  178. public IAsyncResult BeginAccept (
  179. AsyncCallback callback,
  180. object state)
  181. {
  182. throw new NotImplementedException();
  183. }
  184. /// <summary>
  185. /// Connects to a remote endpoint in the background,
  186. /// calling back when finished.
  187. /// </summary>
  188. /// <param name="remote_end_point">The endpoint to
  189. /// connect to</param>
  190. /// <param name="callback">Where to call when done</param>
  191. /// <param name="state">State information for this call</param>
  192. /// <returns></returns>
  193. public IAsyncResult BeginConnect (
  194. EndPoint remote_end_point,
  195. AsyncCallback callback,
  196. object state)
  197. {
  198. throw new NotImplementedException();
  199. }
  200. /// <summary>
  201. /// Receives data in the background, calling
  202. /// back when finished.
  203. /// </summary>
  204. /// <param name="buffer">A buffer to put the data into as it
  205. /// arrives</param>
  206. /// <param name="offset">Where to put the data (offset into
  207. /// the buffer)</param>
  208. /// <param name="size">Buffer size</param>
  209. /// <param name="socket_flags">Socket flags</param>
  210. /// <param name="callback">Where to call when the
  211. /// operation is finished</param>
  212. /// <param name="state">State info for this call</param>
  213. /// <returns></returns>
  214. public IAsyncResult BeginReceive (
  215. byte[] buffer,
  216. int offset,
  217. int size,
  218. SocketFlags socket_flags,
  219. AsyncCallback callback,
  220. object state)
  221. {
  222. throw new NotImplementedException();
  223. }
  224. /// <summary>
  225. /// Receives data in the background from a specific
  226. /// point, calling back when finished.
  227. /// </summary>
  228. /// <param name="buffer">A buffer to put the data into as it
  229. /// arrives</param>
  230. /// <param name="offset">Where to put the data (offset into
  231. /// the buffer)</param>
  232. /// <param name="size">Buffer size</param>
  233. /// <param name="socket_flags">Socket flags</param>
  234. /// <param name="remote_end_point">Where to receive from</param>
  235. /// <param name="callback">Where to call when the
  236. /// operation is finished</param>
  237. /// <param name="state">State info for this call</param>
  238. /// <returns></returns>
  239. public IAsyncResult BeginReceiveFrom (
  240. byte[] buffer,
  241. int offset,
  242. int size,
  243. SocketFlags socket_flags,
  244. ref EndPoint remote_end_point,
  245. AsyncCallback callback,
  246. object state)
  247. {
  248. throw new NotImplementedException();
  249. }
  250. /// <summary>
  251. /// Starts sending data somewhere, in the background.
  252. /// </summary>
  253. /// <param name="buffer">Buffer containing the data to send</param>
  254. /// <param name="offset">Where in the buffer to start sending from</param>
  255. /// <param name="size">Buffer size</param>
  256. /// <param name="socket_flags">Socket flags</param>
  257. /// <param name="callback">Where to call back to when finished</param>
  258. /// <param name="state">State info for this call</param>
  259. /// <returns></returns>
  260. public IAsyncResult BeginSend (
  261. byte[] buffer,
  262. int offset,
  263. int size,
  264. SocketFlags socket_flags,
  265. AsyncCallback callback,
  266. object state)
  267. {
  268. throw new NotImplementedException();
  269. }
  270. /// <summary>
  271. /// Starts sending data to a specific point, in the background
  272. /// </summary>
  273. /// <param name="buffer"></param>
  274. /// <param name="offset"></param>
  275. /// <param name="size"></param>
  276. /// <param name="socket_flags"></param>
  277. /// <param name="remote_end_point"></param>
  278. /// <param name="callback">Where to call back to when
  279. /// finished sending</param>
  280. /// <param name="state"></param>
  281. /// <returns></returns>
  282. public IAsyncResult BeginSendTo (
  283. byte[] buffer,
  284. int offset,
  285. int size,
  286. SocketFlags socket_flags,
  287. EndPoint remote_end_point,
  288. AsyncCallback callback,
  289. object state)
  290. {
  291. throw new NotImplementedException();
  292. }
  293. /// <summary>
  294. /// Binds the socket to a local endpoint
  295. /// </summary>
  296. /// <param name="local_end_point">What to
  297. /// bind it to</param>
  298. public void Bind (EndPoint local_end_point)
  299. {
  300. throw new NotImplementedException();
  301. }
  302. /// <summary>
  303. /// Closes the socket
  304. /// </summary>
  305. public void Close ()
  306. {
  307. throw new NotImplementedException();
  308. }
  309. /// <summary>
  310. /// Connects to a remote system
  311. /// </summary>
  312. /// <param name="remote_end_point">Where to connect to</param>
  313. public void Connect (EndPoint remote_end_point)
  314. {
  315. throw new NotImplementedException();
  316. }
  317. /// <summary>
  318. /// Completes an Accept() operation started
  319. /// with a BeginAccept() call
  320. /// </summary>
  321. /// <param name="result"></param>
  322. /// <returns></returns>
  323. public Socket EndAccept (IAsyncResult result)
  324. {
  325. throw new NotImplementedException();
  326. }
  327. /// <summary>
  328. /// Completes an asynchronous Connect() operation
  329. /// started with a BeginConnect() call
  330. /// </summary>
  331. /// <param name="result"></param>
  332. public void EndConnect (IAsyncResult result)
  333. {
  334. throw new NotImplementedException();
  335. }
  336. /// <summary>
  337. /// Completes an asynchronous Receive() operation
  338. /// started with a BeginReceive() call
  339. /// </summary>
  340. /// <param name="result"></param>
  341. /// <returns></returns>
  342. public int EndReceive (IAsyncResult result)
  343. {
  344. throw new NotImplementedException();
  345. }
  346. /// <summary>
  347. /// Completes an asynchronous ReceiveFrom() operation
  348. /// started with a BeginReceiveFrom() call
  349. /// </summary>
  350. /// <param name="result"></param>
  351. /// <param name="end_point"></param>
  352. /// <returns></returns>
  353. public int EndReceiveFrom (
  354. IAsyncResult result,
  355. ref EndPoint end_point)
  356. {
  357. throw new NotImplementedException();
  358. }
  359. /// <summary>
  360. /// Completes an asynchronous Send() operation
  361. /// started with a BeginSend() call
  362. /// </summary>
  363. /// <param name="result"></param>
  364. /// <returns></returns>
  365. public int EndSend (IAsyncResult result)
  366. {
  367. throw new NotImplementedException();
  368. }
  369. /// <summary>
  370. /// Completes an asynchronous SendTo() operation
  371. /// started with a BeginSendTo() call
  372. /// </summary>
  373. /// <param name="result"></param>
  374. /// <returns></returns>
  375. public int EndSendTo (IAsyncResult result)
  376. {
  377. throw new NotImplementedException();
  378. }
  379. /// <summary>
  380. /// Gets a socket option
  381. /// </summary>
  382. /// <param name="level"></param>
  383. /// <param name="name"></param>
  384. /// <returns></returns>
  385. public object GetSocketOption (
  386. SocketOptionLevel level,
  387. SocketOptionName name)
  388. {
  389. throw new NotImplementedException();
  390. }
  391. /// <summary>
  392. /// Gets a socket option
  393. /// </summary>
  394. /// <param name="level"></param>
  395. /// <param name="name"></param>
  396. /// <param name="opt_value"></param>
  397. public void GetSocketOption (
  398. SocketOptionLevel level,
  399. SocketOptionName name,
  400. byte[] opt_value)
  401. {
  402. throw new NotImplementedException();
  403. }
  404. /// <summary>
  405. /// Gets a socket option
  406. /// </summary>
  407. /// <param name="level"></param>
  408. /// <param name="name"></param>
  409. /// <param name="length"></param>
  410. /// <returns></returns>
  411. public byte[] GetSocketOption (
  412. SocketOptionLevel level,
  413. SocketOptionName name,
  414. int length)
  415. {
  416. throw new NotImplementedException();
  417. }
  418. /// <summary>
  419. /// Does something to the socket, a la ioctl()
  420. /// </summary>
  421. /// <param name="ioctl_code">Code of the operation
  422. /// to perform on the socket</param>
  423. /// <param name="in_value">Data to pass to ioctl()</param>
  424. /// <param name="out_value">Data returned from ioctl()</param>
  425. /// <returns></returns>
  426. public int IOControl (
  427. int ioctl_code,
  428. byte[] in_value,
  429. byte[] out_value)
  430. {
  431. throw new NotImplementedException();
  432. }
  433. /// <summary>
  434. /// Tells the socket to start listening
  435. /// </summary>
  436. /// <param name="backlog">Connection backlog - the number
  437. /// of pending (not Accept()ed) connections that will be
  438. /// allowed before new connections are automatically
  439. /// refused</param>
  440. public void Listen (int backlog)
  441. {
  442. throw new NotImplementedException();
  443. }
  444. /// <summary>
  445. /// Blocks the application until the socket is either
  446. /// readable, writeable or has an error condition
  447. /// </summary>
  448. /// <param name="time_us">How long to wait, in microseconds</param>
  449. /// <param name="mode">What to wait for (reading, writing, error)</param>
  450. /// <returns></returns>
  451. public bool Poll (int time_us, SelectMode mode)
  452. {
  453. throw new NotImplementedException();
  454. }
  455. /// <summary>
  456. /// Receives data from the socket
  457. /// </summary>
  458. /// <param name="buf"></param>
  459. /// <returns></returns>
  460. public int Receive (
  461. byte[] buf)
  462. {
  463. throw new NotImplementedException();
  464. }
  465. /// <summary>
  466. /// Receives data from the socket
  467. /// </summary>
  468. /// <param name="buf"></param>
  469. /// <param name="flags"></param>
  470. /// <returns></returns>
  471. public int Receive (
  472. byte[] buf,
  473. SocketFlags flags)
  474. {
  475. throw new NotImplementedException();
  476. }
  477. /// <summary>
  478. /// Receives data from the socket
  479. /// </summary>
  480. /// <param name="buf"></param>
  481. /// <param name="size"></param>
  482. /// <param name="flags"></param>
  483. /// <returns></returns>
  484. public int Receive (
  485. byte[] buf,
  486. int size,
  487. SocketFlags flags)
  488. {
  489. throw new NotImplementedException();
  490. }
  491. /// <summary>
  492. /// Receives data from the socket
  493. /// </summary>
  494. /// <param name="buf"></param>
  495. /// <param name="offset"></param>
  496. /// <param name="size"></param>
  497. /// <param name="flags"></param>
  498. /// <returns></returns>
  499. public int Receive (
  500. byte[] buf,
  501. int offset,
  502. int size,
  503. SocketFlags flags)
  504. {
  505. throw new NotImplementedException();
  506. }
  507. /// <summary>
  508. /// Receives data from a specific point,
  509. /// through the socket
  510. /// </summary>
  511. /// <param name="buf"></param>
  512. /// <param name="remote_end_point"></param>
  513. /// <returns></returns>
  514. public int ReceiveFrom (
  515. byte[] buf,
  516. ref EndPoint remote_end_point)
  517. {
  518. throw new NotImplementedException();
  519. }
  520. /// <summary>
  521. /// Receives data from a specific point,
  522. /// through the socket
  523. /// </summary>
  524. /// <param name="buf"></param>
  525. /// <param name="flags"></param>
  526. /// <param name="remote_end_point"></param>
  527. /// <returns></returns>
  528. public int ReceiveFrom (
  529. byte[] buf,
  530. SocketFlags flags,
  531. ref EndPoint remote_end_point)
  532. {
  533. throw new NotImplementedException();
  534. }
  535. /// <summary>
  536. /// Receives data from a specific point,
  537. /// through the socket
  538. /// </summary>
  539. /// <param name="buf"></param>
  540. /// <param name="size"></param>
  541. /// <param name="flags"></param>
  542. /// <param name="remote_end_point"></param>
  543. /// <returns></returns>
  544. public int ReceiveFrom (
  545. byte[] buf,
  546. int size,
  547. SocketFlags flags,
  548. ref EndPoint remote_end_point)
  549. {
  550. throw new NotImplementedException();
  551. }
  552. /// <summary>
  553. /// Receives data from a specific point,
  554. /// through the socket
  555. /// </summary>
  556. /// <param name="buf"></param>
  557. /// <param name="offset"></param>
  558. /// <param name="size"></param>
  559. /// <param name="flags"></param>
  560. /// <param name="remote_end_point"></param>
  561. /// <returns></returns>
  562. public int ReceiveFrom (
  563. byte[] buf,
  564. int offset,
  565. int size,
  566. SocketFlags flags,
  567. ref EndPoint remote_end_point)
  568. {
  569. throw new NotImplementedException();
  570. }
  571. /// <summary>
  572. /// Sends data through the socket
  573. /// </summary>
  574. /// <param name="buffer"></param>
  575. /// <returns></returns>
  576. public int Send (
  577. byte[] buffer)
  578. {
  579. throw new NotImplementedException();
  580. }
  581. /// <summary>
  582. /// Sends data through the socket
  583. /// </summary>
  584. /// <param name="buffer"></param>
  585. /// <param name="flags"></param>
  586. /// <returns></returns>
  587. public int Send (
  588. byte[] buffer,
  589. SocketFlags flags)
  590. {
  591. throw new NotImplementedException();
  592. }
  593. /// <summary>
  594. /// Sends data through the socket
  595. /// </summary>
  596. /// <param name="buffer"></param>
  597. /// <param name="size"></param>
  598. /// <param name="flags"></param>
  599. /// <returns></returns>
  600. public int Send (
  601. byte[] buffer,
  602. int size,
  603. SocketFlags flags)
  604. {
  605. throw new NotImplementedException();
  606. }
  607. /// <summary>
  608. /// Sends data through the socket
  609. /// </summary>
  610. /// <param name="buffer"></param>
  611. /// <param name="offset"></param>
  612. /// <param name="size"></param>
  613. /// <param name="flags"></param>
  614. /// <returns></returns>
  615. public int Send (
  616. byte[] buffer,
  617. int offset,
  618. int size,
  619. SocketFlags flags)
  620. {
  621. throw new NotImplementedException();
  622. }
  623. /// <summary>
  624. /// Sends data to a specific point,
  625. /// through the socket
  626. /// </summary>
  627. /// <param name="buffer"></param>
  628. /// <param name="remote_end_point"></param>
  629. /// <returns></returns>
  630. public int SendTo (
  631. byte[] buffer,
  632. EndPoint remote_end_point)
  633. {
  634. throw new NotImplementedException();
  635. }
  636. /// <summary>
  637. /// Sends data to a specific point,
  638. /// through the socket
  639. /// </summary>
  640. /// <param name="buffer"></param>
  641. /// <param name="flags"></param>
  642. /// <param name="remote_end_point"></param>
  643. /// <returns></returns>
  644. public int SendTo (
  645. byte[] buffer,
  646. SocketFlags flags,
  647. EndPoint remote_end_point)
  648. {
  649. throw new NotImplementedException();
  650. }
  651. /// <summary>
  652. /// Sends data to a specific point,
  653. /// through the socket
  654. /// </summary>
  655. /// <param name="buffer"></param>
  656. /// <param name="size"></param>
  657. /// <param name="flags"></param>
  658. /// <param name="remote_end_point"></param>
  659. /// <returns></returns>
  660. public int SendTo (
  661. byte[] buffer,
  662. int size,
  663. SocketFlags flags,
  664. EndPoint remote_end_point)
  665. {
  666. throw new NotImplementedException();
  667. }
  668. /// <summary>
  669. /// Sends data to a specific point,
  670. /// through the socket
  671. /// </summary>
  672. /// <param name="buffer"></param>
  673. /// <param name="offset"></param>
  674. /// <param name="size"></param>
  675. /// <param name="flags"></param>
  676. /// <param name="remote_end_point"></param>
  677. /// <returns></returns>
  678. public int SendTo (
  679. byte[] buffer,
  680. int offset,
  681. int size,
  682. SocketFlags flags,
  683. EndPoint remote_end_point)
  684. {
  685. throw new NotImplementedException();
  686. }
  687. /// <summary>
  688. /// Sets a socket option (like setsockopt())
  689. /// </summary>
  690. /// <param name="level"></param>
  691. /// <param name="name"></param>
  692. /// <param name="opt_value"></param>
  693. public void SetSocketOption (
  694. SocketOptionLevel level,
  695. SocketOptionName name,
  696. byte[] opt_value)
  697. {
  698. throw new NotImplementedException();
  699. }
  700. /// <summary>
  701. /// Sets a socket option (like setsockopt())
  702. /// </summary>
  703. /// <param name="level"></param>
  704. /// <param name="name"></param>
  705. /// <param name="opt_value"></param>
  706. public void SetSocketOption (
  707. SocketOptionLevel level,
  708. SocketOptionName name,
  709. int opt_value)
  710. {
  711. throw new NotImplementedException();
  712. }
  713. /// <summary>
  714. /// Sets a socket option (like setsockopt())
  715. /// </summary>
  716. /// <param name="level"></param>
  717. /// <param name="name"></param>
  718. /// <param name="opt_value"></param>
  719. public void SetSocketOption (
  720. SocketOptionLevel level,
  721. SocketOptionName name,
  722. object opt_value)
  723. {
  724. throw new NotImplementedException();
  725. }
  726. /// <summary>
  727. /// Stops anyone from being able to read or write to the socket
  728. /// </summary>
  729. /// <param name="how">What people aren't allowed to do any
  730. /// more (you can disable just reading or just writing, or both)</param>
  731. public void Shutdown (SocketShutdown how)
  732. {
  733. throw new NotImplementedException();
  734. }
  735. /// <summary>
  736. /// A stringified representation of the socket
  737. /// </summary>
  738. /// <returns></returns>
  739. public override string ToString ()
  740. {
  741. throw new NotImplementedException();
  742. //return "foo";
  743. }
  744. // protected methods:
  745. /// <summary>
  746. /// Disposes of all unmanaged resources, and
  747. /// managed resources too if requested
  748. /// </summary>
  749. /// <param name="disposing">Set this to true
  750. /// to dispose of managed resources</param>
  751. protected virtual void Dispose (bool disposing)
  752. {
  753. // file descriptor / socket
  754. // other things to dispose of?
  755. // managed things?
  756. throw new NotImplementedException();
  757. }
  758. /// <summary>
  759. /// Disposes of everything (managed and
  760. /// unmanaged resources)
  761. /// </summary>
  762. public void Dispose ()
  763. {
  764. Dispose(true);
  765. }
  766. /// <summary>
  767. /// Destructor - disposes of unmanaged resources
  768. /// </summary>
  769. ~Socket ()
  770. {
  771. Dispose(false);
  772. throw new NotImplementedException();
  773. }
  774. }
  775. }