This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- send-udp [s port] | |
(with-open [socket (java.net.DatagramSocket.)] | |
(let [group (java.net.InetAddress/getByName "localhost") | |
bytes (.getBytes s) | |
packet (java.net.DatagramPacket. bytes (count bytes) group port)] | |
(.send socket packet) | |
(.close socket)))) | |
(deftask anybar [p port VAL int "AnyBar port"] | |
(let [port (or port 1738)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn opening? [sym] | |
(when (symbol? sym) | |
(.endsWith (name sym) ">"))) | |
(defn closing? [sym] | |
(when (symbol? sym) | |
(.startsWith (name sym) "<"))) | |
(defn split-closing [t exprs] | |
(split-with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns task02.network | |
(:use [task02 helpers query]) | |
(:require [clojure.java.io :as io] | |
[clojure.string :as str]) | |
(:import [java.net Socket ServerSocket InetAddress InetSocketAddress SocketException])) | |
(def inactive-timeout 20000) | |
;; Объявить переменную для синхронизации между потоками. Воспользуйтесь promise | |
(def ^{:private true :dynamic true} *should-be-finished* nil) |
NewerOlder